Gitlab-runner 命令

注冊Runner

1.運行一下命令:

gitlab-runner register

2.輸入我們的GitLab實例URL

http://repo.ehailiang.com:8088/

3.輸入GitLab項目倉庫的令牌以注冊Runner

4.輸入Runner描述

5.輸入與該Runner關(guān)聯(lián)的標(biāo)簽 (此步千萬不要亂輸入,它是和項目的.gitlab.ci.yml 相對應(yīng)的)

6.輸入Runner執(zhí)行程序 (我們選擇使用docker來進(jìn)行)

7.如果選擇了docker作為執(zhí)行程序,則需要輸入一個默認(rèn)執(zhí)行的鏡像 (此鏡像為已經(jīng)提前做好的掃描代碼規(guī)范的鏡像)

GItLab CI?

當(dāng)注冊了GitLab Runner之后,如何在項目中具體應(yīng)用呢?

.gitlab-ci.yml 詳細(xì)介紹:http://repo.ehailiang.com:8088/help/ci/yaml/README.md

在項目根目錄下創(chuàng)建 .gitlab-ci.yml文件

stages:

- phpcs

- phpstan

job1:

stage: phpcs

image: registry.cn-hangzhou.aliyuncs.com/iclass/phpscan:latest

tags:

- phpcs

only:

- develop

allow_failure:

true

script:

- source /etc/profile

- phpcs --standard=PSR2 --encoding=utf-8 -n -p /builds/iclass/iuser/modules/

job2:

stage: phpstan

image: registry.cn-hangzhou.aliyuncs.com/iclass/phpscan:latest

tags:

- phpstan

only:

- develop

allow_failure:

true

script:

- source /etc/profile

- phpstan analyse --level=1 --no-progress --autoload-file=/builds/iclass/iuser/phpstan.php /builds/iclass/iuser/modules/

具體過程描述:

GitLab Runner 以鏡像?

registry.cn-hangzhou.aliyuncs.com/iclass/phpscan:latest

?創(chuàng)建一個內(nèi)部容器,checkout項目的 develop分支出來 進(jìn)行 script 配置的腳本運行在容器內(nèi)運行,從而掃描我們項目的代碼規(guī)范。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容