Skip to content

Add pull-policy support for images

Furkan Ayhan requested to merge 21619-runner-image-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 👈 You are here
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 !90136 (merged)
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 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:

Future works:

  • E2E test
  • Supporting not only images but also services

Screenshots or screen recordings

When you define a CI config;

image:
  name: ruby:2.7.6-alpine

test:
  script: ruby -v

This is the default behavior:

Screen_Shot_2022-04-20_at_19.30.42

Now you can define a pull_policy:

image:
  name: ruby:2.7.6-alpine
  pull_policy: if-not-present

test:
  script: ruby -v

Screen_Shot_2022-04-20_at_19.30.47

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

Screen_Shot_2022-05-23_at_13.31.55

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