Add pull-policy support for service images on CI config
Steps
Step | Status |
---|---|
1. Runner: Implement allowed_pull_policies in config.toml | gitlab-runner!3422 (merged) |
2. Runner: Implement supporting pull_policy from jobs | gitlab-runner!3412 (merged) |
3. GitLab: Add pull-policy support for images | !85588 (merged) |
4. Runner: Add image pull-policy support to services | gitlab-runner!3488 (closed) |
5. GitLab: Add pull-policy support for service images on CI config |
|
6. Runner: Add the pull-policy from jobs support to Kubernetes | gitlab-runner!3504 (merged) |
What does this MR do and why?
- This is the next step of #21619 (closed).
- The first iteration was to support
pull_policy
only for job images: !85588 (merged)
This MR implements the support of accepting pull_policy
for services from CI config and sending it to Runner.
pull_policy
can be either a string or an array of strings. More detail: https://docs.gitlab.com/runner/executors/docker.html#using-multiple-pull-policies
Notes:
- It's behind a feature flag
ci_docker_image_pull_policy
(#363186 (closed)). - In order to make this work, gitlab-runner!3412 (merged) and gitlab-runner!3488 (closed) are required.
- We can merge this without the Runner work since this is behind a feature flag.
Screenshots or screen recordings
When you define a CI config;
job1:
script: echo "this job uses postgres:11.7"
services:
- name: postgres:11.7
This is the default behavior:
Now you can define a pull_policy
:
job2:
script: echo "this job uses postgres:11.7"
services:
- name: postgres:11.7
pull_policy: if-not-present
If you use the pull_policy
"never" and there is no image in the Runner:
job3:
script: echo "this job uses postgres:11.7"
services:
- name: postgres:11.7
pull_policy: never
If the Runner does not allow the defined pull policy (allowed_pull_policies
, gitlab-runner!3422 (merged))
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Furkan Ayhan