当前位置:  开发笔记 > 后端 > 正文

gitlab ci / cd运行器卡住

如何解决《gitlabci/cd运行器卡住》经验,为你挑选了1个好方法。

我已经安装了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看到那个跑步者:

但是当我推动主管道阻塞时:

这是.gitlab-ci.yml我尝试管道处理的项目中的文件:

build_image:
  script:
    - docker stop warehouse warehouse_redis
    - docker-compose build
    - docker-compose up -d

如果我手动在服务器上构建此文件,则一切正常。

因此,在推动亚军时,卡住了,没有任何有关问题的信息。我有想念吗?请帮帮我。我想在gitlab服务器Droplet上运行ci / cd管道。但是要使用IDE在本地PC上编辑源。



1> Dan Vulpe..:

看起来您的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

推荐阅读
贾志军
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有