Reputation: 30035
I have a multistage CI/CD setup which uses the default image (the runner is hosted on my server).
I need one stage to use a specific image (a MQTT client to send a single MQTT message but it does not really matter):
# .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`"
Everything runs smoothly until the reload
stage:
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
is not recognized as a command in this image. But it does exist there, since the following command is successful:
docker run --init -it --rm efrecon/mqtt-client pub -h mqtt.mydomain -t dash/reload -m "`date`"
It is also successful if I start a bash
and run pub
from there.
All this leads me to wondering whether the image efrecon/mqtt-client
is actually used in that stage. How could I check that?
Bonus question: if the image is correctly used, what could have gone wrong with the pub
command?
Upvotes: 1
Views: 1050
Reputation: 4478
The efrecon/mqtt-client
image is not used for the reload job, since it is using the shell
runner as stated on line 3 of the jobs output:
Using Shell executor...
It would seem your runner is configured as just a shell executor and should be configured as docker executor as well.
Upvotes: 2