mac安裝gitlab-ci-multi-runner運(yùn)行sonar

安裝maven

wget http://apache-mirror.rbc.ru/pub/apache/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
tar xzvf apache-maven-3.3.9-bin.tar.gz
export PATH=apache-maven-3.3.9/bin:$PATH
export PATH=/usr/local/bin/apache-maven-3.3.9/bin:$PATH

安裝gitlab-ci-multi-runner

如果gitlab是8版本的,很悲催

Because of this Runner >= 9.0 requires GitLab CE/EE >= 9.0 and will not work
with older GitLab versions.
因?yàn)楣俜浇o的文檔里頭,Install on macOS

sudo curl --output /usr/local/bin/gitlab-runner https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/latest/binaries/gitlab-ci-multi-runner-darwin-amd64

這個(gè)安裝的版本跟gitlab8不兼容,淚奔

解決方案,安裝指定版本
https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/v1.11.2/index.html
從這里下載binaries/gitlab-ci-multi-runner-darwin-amd64
然后

cp gitlab-ci-multi-runner-darwin-amd64 /usr/local/bin/gitlab-ci-multi-runner
chmod +x /usr/local/bin/gitlab-ci-multi-runner

配置

?  ~ gitlab-ci-multi-runner register
WARNING: Running in user-mode.
WARNING: Use sudo for system-mode:
WARNING: $ sudo gitlab-runner...

Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
http://gitlab.xxx.com.cn/ci
Please enter the gitlab-ci token for this runner:
xxxx-xxxxx
Please enter the gitlab-ci description for this runner:
[xxxx-Pro.local]: sonar-maven-java8
Please enter the gitlab-ci tags for this runner (comma separated):
maven
Whether to run untagged builds [true/false]:
[false]: true
Registering runner... succeeded                     runner=zm4f-eFf
Please enter the executor: docker-ssh, virtualbox, docker+machine, docker-ssh+machine, docker, parallels, shell, ssh, kubernetes:
shell
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!

運(yùn)行

gitlab-ci-multi-runner install
gitlab-ci-multi-runner start
gitlab-ci-multi-runner run

配置gitlab runner環(huán)境變量

vim ~/.gitlab-runner/config.toml

完整如下

concurrent = 1
check_interval = 0

[[runners]]
  name = "sonar-maven-java8"
  url = "http://gitlab.xxxx.com.cn/ci"
  token = "xxxxxx"
  environment = ["MAVEN_HOME=/Users/xxxx/xxxx/build/apache-maven-3.3.9"]
  executor = "shell"
  [runners.cache]

配置maven的settings

vim ~/.m2/settings.xml

完整如下

<settings>
    <mirrors>
        <mirror>
            <id>nexus-aliyun</id>
            <mirrorOf>*</mirrorOf>
            <name>Nexus aliyun</name>
            <url>http://maven.aliyun.com/nexus/content/groups/public</url>
        </mirror> 
    </mirrors>
    <profiles>
        <profile>
            <id>sonar</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <!-- Optional URL to server. Default value is http://localhost:9000 -->
                <sonar.host.url>SONAR_HOST_URL</sonar.host.url>
                <!--<sonar.jdbc.url>SONAR_JDBC_URL</sonar.jdbc.url>-->
                <!--<sonar.jdbc.username>SONAR_JDBC_USER</sonar.jdbc.username>-->
                <!--<sonar.jdbc.password>SONAR_JDBC_PWD</sonar.jdbc.password>-->
                <sonar.sourceEnconding>UTF-8</sonar.sourceEnconding>
            </properties>
        </profile>
    </profiles>
</settings>

之后就基本完工了

doc

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

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

  • Spring Cloud為開發(fā)人員提供了快速構(gòu)建分布式系統(tǒng)中一些常見模式的工具(例如配置管理,服務(wù)發(fā)現(xiàn),斷路器,智...
    卡卡羅2017閱讀 136,554評(píng)論 19 139
  • 一、持續(xù)集成(Continuous Integration) 要了解GitLab-CI與GitLab Runner...
    tsyeyuanfeng閱讀 98,502評(píng)論 17 134
  • GitLab Continuous Integration(CI) If you add a .gitlab-ci...
    xiaojianxu閱讀 1,542評(píng)論 0 0
  • GitLab-CI就是一套配合GitLab使用的持續(xù)集成系統(tǒng)。 OS X系統(tǒng)完成可出現(xiàn)集成,需要安裝gitlab,...
    paradisery閱讀 4,538評(píng)論 7 7
  • 翻看流年的畫冊(cè), 每章都豐韻難忘。 把春夏秋冬養(yǎng)在文字里, 把溫暖和美麗放在心里, 在靜時(shí), 讓心插上翅膀可以追逐...
    云做的水閱讀 103評(píng)論 0 3

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