我有安装了gitlab omnibus服务器,gitlab-runner和docker的Droplet。 尝试配置运行器以在每次推送至master分支时重建并运行docker容器。 遵循gitlab的说明:
我注册了亚军:
$ sudo gitlab-runner register
Runtime platform arch=amd64 os=linux pid=8665 revision=3afdaba6 version=11.5.0
Running in system-mode.
Please enter the gitlab-ci coordinator URL (e.g. https://gitlab.com/):
http://example.com/
Please enter the gitlab-ci token for this runner:
ru7i9G9R-3BJn2RXKdtv
Please enter the gitlab-ci description for this runner:
[ubuntu-s-1vcpu-1gb-fra1-01]: warehouse
Please enter the gitlab-ci tags for this runner (comma separated):
warehouse
Registering runner... succeeded runner=ru7i9G9R
Please enter the executor: parallels, ssh, virtualbox, docker+machine, kubernetes, docker, docker-ssh, shell, docker-ssh+machine:
docker
Please enter the default Docker image (e.g. ruby:2.1):
warehouse:latest
Runner registered successfully. Feel free to start it, but if it's running already the config should be automatically reloaded!
这是跑步者注册时生成的config.toml文件:
$ sudo cat /etc/gitlab-runner/config.toml
concurrent = 1
check_interval = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "warehouse"
url = "http://example.com/"
token = "f5b8036463e2f97d2ab4bc721b6a91"
executor = "docker"
[runners.docker]
tls_verify = false
image = "warehouse:latest"
privileged = false
disable_entrypoint_overwrite = false
oom_kill_disable = false
disable_cache = false
volumes = ["/cache"]
shm_size = 0
[runners.cache]
[runners.cache.s3]
[runners.cache.gcs]
赛跑者还活着:
$ sudo gitlab-runner verify
Runtime platform arch=amd64 os=linux pid=9417 revision=3afdaba6 version=11.5.0
Running in system-mode.
Verifying runner... is alive runner=f5b80364
然后我运行它:
$ sudo gitlab-runner run
Runtime platform arch=amd64 os=linux pid=9678 revision=3afdaba6 version=11.5.0
Starting multi-runner from /etc/gitlab-runner/config.toml ... builds=0
Running in system-mode.
Configuration loaded builds=0
Listen address not defined, metrics server disabled builds=0
Listen address not defined, session server disabled builds=0
这是我尝试管道处理的项目中的.gitlab-ci.yml
文件:
build_image:
script:
- docker stop warehouse warehouse_redis
- docker-compose build
- docker-compose up -d
如果我在服务器上手动构建此文件,则一切正常。
因此,在推动亚军时,卡住了,没有任何有关问题的信息。 我有想念吗?请帮帮我。我想在gitlab服务器Droplet上运行ci / cd管道。但是要使用IDE在本地PC上编辑源。
答案 0 :(得分:5)
好像您的gitlab-runner没有配置为运行未加标签的作业。跑步者已使用warehouse
标签注册。
您可以配置gitlab管道以使用warehouse
标签(https://docs.gitlab.com/ee/ci/yaml/README.html#tags):
build_image:
script:
- docker stop warehouse warehouse_redis
- docker-compose build
- docker-compose up -d
tags:
- warehouse