Kubernetes runner does not recognize allowed_pull_policies in values.yaml
Summary
The Kubernetes runner can have allowed_pull_policies defined in the values.yaml. When running a job with an allowed_pull_policies the job will fail because the pull_policy in the job defintion is not one of the defined pull policies:
ERROR: Preparation failed: failed to pull image 'registry.gitlab.com/duncan_harris_ultimate_group/cicd-toolbox:latest': pull_policy ([Always]) defined in GitLab pipeline config is not one of the allowed_pull_policies ([])
Steps to reproduce
- Deploy a Kubernetes runner with
allowed_pull_policiesset. - Attempt to run a job with an image
pull_policydefined.
.gitlab-ci.yml
use_image:
stage: test
tags:
- specific-runner
image:
name: registry.gitlab.com/duncan_harris_ultimate_group/cicd-toolbox:latest
pull_policy: always
script:
- echo "Hello!"
Actual behavior
The job will terminate with a Runner System Error because the defined pull_policy is not in the list of allowed_pull_policies
Expected behavior
The allowed_pull_policy should be applied and used
Relevant logs and/or screenshots
Job log showing the issue.
Running with gitlab-runner 16.3.0 (8ec04662)
on gitlab-runner-67447c6c5c-q7749 HkYj9sFB-, system ID: r_hI4zuHE8rmye
Resolving secrets 00:00
Preparing the "kubernetes" executor 00:09
ERROR: Preparation failed: failed to pull image 'registry.gitlab.com/duncan_harris_ultimate_group/cicd-toolbox:latest': pull_policy ([Always]) defined in GitLab pipeline config is not one of the allowed_pull_policies ([])
Will be retried in 3s ...
ERROR: Preparation failed: failed to pull image 'registry.gitlab.com/duncan_harris_ultimate_group/cicd-toolbox:latest': pull_policy ([Always]) defined in GitLab pipeline config is not one of the allowed_pull_policies ([])
Will be retried in 3s ...
ERROR: Preparation failed: failed to pull image 'registry.gitlab.com/duncan_harris_ultimate_group/cicd-toolbox:latest': pull_policy ([Always]) defined in GitLab pipeline config is not one of the allowed_pull_policies ([])
Will be retried in 3s ...
ERROR: Job failed (system failure): failed to pull image 'registry.gitlab.com/duncan_harris_ultimate_group/cicd-toolbox:latest': pull_policy ([Always]) defined in GitLab pipeline config is not one of the allowed_pull_policies ([])
Environment description
Kubernetes runner deployed via Helm chart 0.56.1.
values.yaml contents
gitlabUrl: https://gitlab.com/
rbac:
create: true
runnerToken: glrt-ValidToken
logLevel: debug
runners:
config: |
[[runners]]
[runners.kubernetes]
namespace = "{{.Release.Namespace}}"
image = "alpine:latest"
allowed_pull_policies = ["always", "if-not-present"]
pull_policies = ["always", "if-not-present"]
Partial config.toml
listenaddress: ""
sessionserver:
listenaddress: ""
advertiseaddress: ""
sessiontimeout: 1800
concurrent: 10
checkinterval: 30
loglevel: debug
logformat: null
user: ""
runners:
- name: gitlab-runner-5bc966f4d9-xxvwm
limit: 0
outputlimit: 0
requestconcurrency: 0
unhealthyrequestslimit: 0
unhealthyinterval: null
systemidstate: {}
runnercredentials:
url: https://gitlab.com/
id: 27839208
token: glrt-ValidToken
runnersettings:
executor: kubernetes
kubernetes:
allowedpullpolicies:
- always
- if-not-present
allowedservices: []
pullpolicy: []
Used GitLab Runner version
Running with gitlab-runner 16.3.0 (8ec04662)