昨天完成了gitlab的安装,今天我们接着抽出一点时间安装gitlab-runner,等后面有时间再做CICD实验,下面我们来看看gitlab-runner的安装
https://gitlab-runner-downloads.s3.amazonaws.com/latest/index.html
wget https://gitlab-runner-downloads.s3.amazonaws.com/latest/deb/gitlab-runner_amd64.deb
然后安装gitlab-runner,安装gitlab-runner需要先安装curl命令
sudo apt install curl sudo dpkg -i gitlab-runner_amd64.deb
安装完以后我们需要注册gitlab-runner
注册gitlab-runner的信息可以在gitlab->setting->CICD页面的runner,然后点击右侧展开可以查看到
我的如图
sudo gitlab-runner register Runtime platform arch=amd64 os=linux pid=6151 revision=8925d9a0 version=14.1.0 Running in system-mode. Enter the GitLab instance URL (for example, https://gitlab.com/): http://192.168.122.66:7800/ Enter the registration token: aJWDrg63v3-vJAPHixKG Enter a description for the runner: [gitlab]: test Enter tags for the runner (comma-separated): test-runner Registering runner... succeeded runner=aJWDrg63 Enter an executor: ssh, virtualbox, docker+machine, docker-ssh+machine, parallels, docker, docker-ssh, shell, kubernetes, custom: shell Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
注册成功可以上述位置的下面查看到下图的runner信息
也可以下面命令查看git-runner的注册信息
sudo cat /etc/gitlab-runner/config.toml concurrent = 1 check_interval = 0 [session_server] session_timeout = 1800 [[runners]] name = "test" url = "http://192.168.122.66:7800/" token = "SiSbzgSY_kyzx-Bp9eMi" executor = "shell" [runners.custom_build_dir] [runners.cache] [runners.cache.s3] [runners.cache.gcs] [runners.cache.azure]
查看gitlab-runner验证信息
sudo gitlab-runner verify Runtime platform arch=amd64 os=linux pid=7308 revision=8925d9a0 version=14.1.0 Running in system-mode. Verifying runner... is alive runner=SiSbzgSY
查看gitlab-runner列表
sudo gitlab-runner list Runtime platform arch=amd64 os=linux pid=7342 revision=8925d9a0 version=14.1.0 Listing configured runners ConfigFile=/etc/gitlab-runner/config.toml test Executor=shell Token=SiSbzgSY_kyzx-Bp9eMi URL=http://192.168.122.66:7800/
到此gitlab-runner安装和简单的注册就已经完成