mac安装gitlab-ci-multi-runner运行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.

因为官方给的文档里头,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

这个安装的版本跟gitlab8不兼容,泪奔

解决方案,安装指定版本
https://gitlab-ci-multi-runne...
从这里下载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!

运行

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

配置gitlab runner环境变量

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值