命令失败时如何检查在 GitLab 运行程序中使用了哪个图像?
How to check which image was used in a GitLab runner when a command fails?
我有一个使用默认图像的多阶段 CI/CD 设置(运行ner 托管在我的服务器上)。
我需要一个阶段来使用特定图像(MQTT 客户端发送单个 MQTT 消息,但这并不重要):
# .gitlab-ci.yml
stages:
- backend
- frontend
- reload
# backends deployment
googlecalendar:
stage: backend
script:
- docker build -t dash-googlecalendar -f backends/googlecalendar/Dockerfile backends
(... there are other builds at the backend stage here ...)
# frontend deployment
frontend:
stage: frontend
script:
- docker build -t dash-frontend -f frontend/Dockerfile frontend
(...)
# MQTT message
reload:
stage: reload
image: efrecon/mqtt-client
script:
- pub -h mqtt.mydomain -t dash/reload -m "`date`"
一切运行顺利,直到reload
阶段:
Running with gitlab-runner 12.2.0 (a987417a)
on srv zN2MsS9q
Using Shell executor...
Running on srv...
Fetching changes...
Reinitialized existing Git repository in /home/gitlab-runner/builds/zN2MsS9q/0/wsw70-docker/dash/.git/
Checking out 7d19cb65 as master...
Skipping Git submodules setup
$ pub -h mqtt.mudomain -t dash/reload -m "`date`"
bash: line 82: pub: command not found
ERROR: Job failed: exit status 1
pub
在此图像中未被识别为命令。但它确实在那里存在,因为以下命令成功:
docker run --init -it --rm efrecon/mqtt-client pub -h mqtt.mydomain -t dash/reload -m "`date`"
从那里启动bash
和运行pub
也是成功的。
所有这些让我想知道图像 efrecon/mqtt-client
是否真的在那个阶段使用过。我该如何检查?
额外问题:如果图像使用正确,pub
命令可能出了什么问题?
efrecon/mqtt-client
图像不用于重新加载作业,因为它使用 shell
转轮,如作业输出第 3 行所述:
Using Shell executor...
您的跑步者似乎也配置为 shell executor and should be configured as docker executor。
我有一个使用默认图像的多阶段 CI/CD 设置(运行ner 托管在我的服务器上)。
我需要一个阶段来使用特定图像(MQTT 客户端发送单个 MQTT 消息,但这并不重要):
# .gitlab-ci.yml
stages:
- backend
- frontend
- reload
# backends deployment
googlecalendar:
stage: backend
script:
- docker build -t dash-googlecalendar -f backends/googlecalendar/Dockerfile backends
(... there are other builds at the backend stage here ...)
# frontend deployment
frontend:
stage: frontend
script:
- docker build -t dash-frontend -f frontend/Dockerfile frontend
(...)
# MQTT message
reload:
stage: reload
image: efrecon/mqtt-client
script:
- pub -h mqtt.mydomain -t dash/reload -m "`date`"
一切运行顺利,直到reload
阶段:
Running with gitlab-runner 12.2.0 (a987417a)
on srv zN2MsS9q
Using Shell executor...
Running on srv...
Fetching changes...
Reinitialized existing Git repository in /home/gitlab-runner/builds/zN2MsS9q/0/wsw70-docker/dash/.git/
Checking out 7d19cb65 as master...
Skipping Git submodules setup
$ pub -h mqtt.mudomain -t dash/reload -m "`date`"
bash: line 82: pub: command not found
ERROR: Job failed: exit status 1
pub
在此图像中未被识别为命令。但它确实在那里存在,因为以下命令成功:
docker run --init -it --rm efrecon/mqtt-client pub -h mqtt.mydomain -t dash/reload -m "`date`"
从那里启动bash
和运行pub
也是成功的。
所有这些让我想知道图像 efrecon/mqtt-client
是否真的在那个阶段使用过。我该如何检查?
额外问题:如果图像使用正确,pub
命令可能出了什么问题?
efrecon/mqtt-client
图像不用于重新加载作业,因为它使用 shell
转轮,如作业输出第 3 行所述:
Using Shell executor...
您的跑步者似乎也配置为 shell executor and should be configured as docker executor。