Skip to content

Commit

Permalink
支持user:token方式提测 (#459)
Browse files Browse the repository at this point in the history
### What problem were solved in this pull request?

Issue Number: close #283

Problem:
当前训练营提测比赛项目时,需要邀请官方后台选手增加代码仓库权限,github需要后台审批,会有延迟。

### What is changed and how it works?
支持填写提测URL时,URL 中包含 user:token 来提测private仓库,不需要再邀请官方后台测试人员增加权限,效率提升。
  • Loading branch information
hnwyllmm authored Oct 14, 2024
1 parent 53c72d6 commit e9c201b
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 6 deletions.
55 changes: 49 additions & 6 deletions docs/docs/game/github-introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ title: MiniOB GitHub 在训练营中的使用说明

## 简介

训练营测试后端现在支持使用 [GitHub](https://github.com)[Gitee](https://gitee.com) 作为代码仓库管理平台。

本文介绍如何在GitHub上创建私有仓库,并将MiniOB代码提交到自己的仓库中,然后在训练营中进行测试。

MiniOB 仓库地址:<https://github.com/oceanbase/miniob>
Expand Down Expand Up @@ -48,7 +46,51 @@ https://github.com/oceanbase/miniob

![view repo](images/github-view-repo.png)

6. 邀请OceanBase测试账号
## 仓库权限设置

到此为止,已经创建完了私有仓库,并导入了代码。但是此时官方测试账号并没有权限查看你的代码,接下来需要给官方测试账号添加权限。有两种方法,一种是生成token,另一种是邀请OceanBase测试账号。

### 生成token
1. 在GitHub页面,点击个人头像,选择"Settings",进入个人设置页面。
![personal settings](images/github-personal-settings.png)

2. 接着在左侧导航栏中选择"Developer settings",进入开发者设置页面。
![develop settings](images/github-developer-settings.png)

3. 找到生成新token的页面。
![generate new token](images/github-generate-new-token.png)

4. 填写token的信息,生成token。
![fill out token info](images/github-fill-out-token-form.jpg)

5. 生成token后要第一时间保存,离开页面后将无法再次查看。
![save token](images/github-save-token.png)

6. 验证token是否生效
执行 git clone 命令,URL中带上 username和token,如果能够正常clone,则说明token生效。

```bash
git clone https://`your-github-username`:`github_pat_your-github-token`@github.com/`repo-owner`/`repo-name`
```

> your-github-username 替换成你的GitHub用户名<br/>
> github_pat_your-github-token 替换成你的生成的token<br/>
> repo-owner 替换成你的仓库所属者,通常也是你的GitHub用户名<br/>
> repo-name 替换成你的仓库名,比如 miniob-2024
比如:

```bash
git clone https://hnwyllmm:[email protected]/hnwyllmm/miniob-2023
```

一个clone成功的例子
![validate token](images/github-validate-token.png)

**注意:提测时的URL需要填写带user:token的地址**
![commit](images/github-commit-info.png)

### 邀请OceanBase测试账号

点击"Settings"标签,进入仓库设置页面,点击"Collaborators"标签,进入仓库权限管理页面。

Expand All @@ -66,8 +108,9 @@ GitHub 在邀请别人加入仓库时,会发送邮件通知被邀请人,需

![pending invite](images/github-pending-invite.png)

![invite success](images/images/github-invite-success.png)
![invite success](images/github-invite-success.png)

7. 提交测试
## 提交测试

等官网人员通过邀请后,就可以提交测试了。训练营的使用说明不再赘述,可以参考 [训练营使用说明](https://ask.oceanbase.com/t/topic/35600372)
如果是邀请OceanBase测试账号,需要等官网人员通过邀请后,开始提交测试。
训练营的使用说明不再赘述,可以参考 [训练营使用说明](https://ask.oceanbase.com/t/topic/35600372)
Binary file added docs/docs/game/images/github-commit-info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/game/images/github-save-token.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/docs/game/images/github-validate-token.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions docs/docs/how_to_build.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ MiniOB 需要使用:

如果是第一次在这个环境上编译miniob,需要安装一些miniob的依赖库,执行下面的命令即可安装:

> 重要提示:如果使用Windows系统,请先配置 git autocrlf 为 false。
> 执行:`git config --global core.autocrlf false`
> 防止脚本换行符被修改。
```bash
bash build.sh init
```
Expand Down Expand Up @@ -132,6 +136,23 @@ sudo bash build.sh init

则不会因为找不到cmake而报错。

### 2. build.sh: line 2: $'\r': command not found
在执行build.sh脚本时,遇到下面的错误
![crlf error](images/miniob-build-crlf.png)

通常是使用Windows电脑下载源码,然后在docker或虚拟机中运行build.sh脚本运行时出现这个错误。

***解决方法:***

执行下面的脚本,设置git不要切换换行符。
```bash
git config --global core.autocrlf false
```
然后删除源码重新下载(clone)。

***问题原因:***
在Windows上git clone源码后,文本文件(包括build.sh)换行符被修改为 '\r\n'(CRLF),这个换行符在Linux上不能识别,Linux的换行符是'\n'(LF)。

**更多信息:**

关于该问题的更多细节,请参考[问题来源](https://ask.oceanbase.com/t/topic/35604437/7)
Expand Down
Binary file added docs/docs/images/miniob-build-crlf.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e9c201b

Please sign in to comment.