I don't understand the mechanism of the keywords image
and services
in the file.gitlab-ci.yml. when do we know on which image the commands of the keyword script
are executed ?
When i read the gitlabci documentation i understand the theory of the keywords "image" and "services" well, so i have already done tests and managed to interact with a httpd
service by a wget for example, however, in practice i can't understand what the image is for ?
Let me explain :)
First i created a structure with a job that makes a "uname -a" by not declaring any images:
job_scriptWithDefaultImage:
stage: gitlabtest1
script:
- uname -a
The result then shows me a "uname -a" running on the runner:
$ uname -a
Linux runner-b41b332f-project-9060-concurrent-0 4.4.0-104-generic #127-Ubuntu SMP Mon Dec 11 12:16:42 UTC 2017 x86_64 Linux
Then i simply add an image in my job specifying i want to use an alpine:
job_scriptWithAlpineImage:
internship: gitlabtest2
image: registry.hub.docker.com/library/alpine:latest
script:
- uname -a
The result is exactly the same, the uname always runs on the runner, instead of my alpine ...
$ uname -a
Linux runner-9cade5e3-project-9060-concurrent-0 4.4.0-130-generic #156-Ubuntu SMP Thu Jun 14 08:53:28 UTC 2018 x86_64 GNU/Linux
So i don't understand at all:
- What my image is for ?
- How to execute commands in that image in my pipeline job
script
section ?