gpt4 book ai didi

docker - gitlab ci/cd 转轮卡住了

转载 作者:行者123 更新时间:2023-12-04 18:55:57 25 4
gpt4 key购买 nike

我有安装了 gitlab 综合服务器、gitlab-runner 和 docker 的 droplet。
尝试配置 runner 以在每次推送到 master 分支时重建和运行 docker 容器。
按照 gitlab 的说明:

enter image description here

我注册了运行者:

$ 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 看到那个运行者:
enter image description here

但是当我推送到主管道时:
enter image description here

enter image description here

enter image description here

enter image description here

这是我尝试管道化的项目中的 .gitlab-ci.yml 文件:
build_image:
script:
- docker stop warehouse warehouse_redis
- docker-compose build
- docker-compose up -d

如果我手动在服务器上构建它,一切正常。

因此,在没有任何有关问题的信息的情况下,插入运行者只是卡住了。
我错过了什么吗?请帮帮我。我想在 gitlab 服务器 droplet 上运行 ci/cd 管道。但想使用 IDE 在本地 PC 上编辑源代码。

最佳答案

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

关于docker - gitlab ci/cd 转轮卡住了,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53571539/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com