devops之路gitlab runner
GitLab 8.0 开始,GitLab CI 就已经集成在 GitLab 中,我们只要在项目中添加一个 .gitlab-ci.yml 文件,然后添加一个 Runner,即可进行持续集成
gitlab runner承担gitlab ci的构建任务。
gitlab runner安装
# For Debian/Ubuntu $ curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-ci-multi-runner/script.deb.sh | sudo bash $ sudo apt-get install gitlab-ci-multi-runner
注册 Runner
runner安装成功后,怎么将runner和gitlab ci工具关联起来
sudo gitlab-ci-multi-runner register 输入 CI URL 输入 Token 输入 Runner 的名字 选择 Runner 的类型,选shell
查看runner的状态
sudo gitlab-ci-multi-runner list $ sudo gitlab-runner list Listing configured runners ConfigFile=/etc/gitlab-runner/config.toml my-runner Executor=shell Token=cd1cd7cf243afb47094677855aacd3 URL=http://mygitlab.com/ci
runner执行任务
runner和gitlab已经建立起了关联关系,那么怎么定义runner要执行的任务呢
在gitlab代码版本库中添加.gitlab-ci.yml脚本配置文件
例如:
# 定义 stages stages: - build - test # 定义 job job1: stage: test script: - echo "I am job1" - echo "I am in test stage" # 定义 job job2: stage: build script: - echo "I am job2" - echo "I am in build stage"
以上配置就是runner要执行的命令
相关推荐
花落兰亭 2020-06-09
cxin 2020-11-06
synshitou 2020-10-21
Topbeyond 2020-08-21
happyfreeangel 2020-07-27
白开水 2020-07-19
无风的雨 2020-07-08
贤时间 2020-07-06
wishli 2020-06-28
小信 2020-06-21
leehbhs 2020-06-20
happyfreeangel 2020-06-18
83284950 2020-06-17
冯冯领队 2020-06-16
就是那个胖子 2020-06-14
83284950 2020-06-14
LiHansiyuan 2020-06-14
fcds00 2020-06-11