Skip to content

Add pull-policy support for service images on CI config

Furkan Ayhan requested to merge 21619-service-pull-policy into master

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 👈 You are here
6. Runner: Add the pull-policy from jobs support to Kubernetes gitlab-runner!3504 (merged)

What does this MR do and why?

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:

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:

Screen_Shot_2022-06-10_at_19.27.20


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

Screen_Shot_2022-06-10_at_19.26.16


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

Screen_Shot_2022-06-10_at_19.28.50


If the Runner does not allow the defined pull policy (allowed_pull_policies, gitlab-runner!3422 (merged))

Screen_Shot_2022-06-14_at_18.37.40

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Furkan Ayhan

Merge request reports

Loading