Pull helper image from GitLab.com registry
What does this MR do?
Pull helper image from GitLab.com registry behind the FF_GITLAB_REGISTRY_HELPER_IMAGE feature flag
Why was this MR needed?
In !2540 (merged) the
helper images are also published on registry.gitlab.com because of the
new DockerHub
limits.
By default, Docker and Kubernetes runners are pulling images from
DockerHub, when FF_GITLAB_REGISTRY_HELPER_IMAGE feature flag is turned
on, it will pull the helper image from registry.gitlab.com. This
prevents users from reaching the DockerHub limits when just running a
build.
What's the best way to test this MR?
Docker Linux
-
Have the following
.gitlab-ci.yml.gitlab-ci.yml
job: stage: test script: - sleep 300 -
Make sure you don't have
gitlab/gitlab-runner-helper:x86_64-latestlocally, if you do rundocker rmi gitlab/gitlab-runner-helper:x86_64-latest -
Start the runner for example with
go run main.go run -c config.tomlexample config.toml
[[runners]] name = "docker" url = "http://192.168.1.79:3000/" token = "xxxx" executor = "docker" [runners.docker] tls_verify = false image = "alpine:3.12" privileged = true disable_entrypoint_overwrite = false oom_kill_disable = false disable_cache = false volumes = ["/cache"] pull_policy = "if-not-present" shm_size = 0 -
Run the job
-
You should see the following inside the job trace
-
Make sure you don't have
registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-latestlocally, if you do rundocker rmi registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-latest -
Run the same job, but this time set
FF_GITLAB_REGISTRY_HELPER_IMAGEtotrueeither in theconfig.tomlor when you start the pipeline. More information on how to enable a feature flag -
You should see the following inside the job trace
Docker Windows
-
Have the following
.gitlab-ci.yml.gitlab-ci.yml
job: stage: test script: - sleep 300 -
Start windows dev environment
vagrant up -
Run
vagrant sshorvagrant rdpto log into the Windows machine -
Make sure you don't have
gitlab/gitlab-runner-helper:x86_64-latest-servercore1809locally, if you do rundocker rmi gitlab/gitlab-runner-helper:x86_64-latest-servercore1809 -
Start the runner for example with
go run .\main.go run -c .\config.tomlexample config.toml
[[runners]] name = "docker-windows" url = "http://192.168.190.160:3000/" token = "xxxx" executor = "docker-windows" [runners.docker] tls_verify = false image = "mcr.microsoft.com/windows/servercore:1809-amd64" disable_entrypoint_overwrite = false oom_kill_disable = false disable_cache = false volumes = ["C:\\cache"] -
Run the job
-
You should see the following in the job trace
-
Run the same job, but this time set
FF_GITLAB_REGISTRY_HELPER_IMAGEtotrueeither in theconfig.tomlor when you start the pipeline. More information on how to enable a feature flag -
You should see the following in the job trace
Kubernetes
-
- Have the following
.gitlab-ci.yml
.gitlab-ci.yml
job: stage: test script: - sleep 300 - Have the following
-
Start minikube
minikube start -
Run GitLab Runner for example
go run main.go run -c config.tomlconfig.toml
[[runners]] name = "kubernetes" url = "http://192.168.1.79:3000/" token = "xxxxxxx" executor = "kubernetes" [runners.kubernetes] bearer_token_overwrite_allowed = false image = "alpine:3.12" -
When the job is running, run the following command to check which help image was pulled
-
Find out pod running job from job trace
Running on runner-mkp1g3gh-project-20-concurrent-0mxspm via steve-mbp-gitlab.local... -
kubectl get po/runner-mkp1g3gh-project-20-concurrent-0mxspm -o json | jq '.spec.containers | keys[] as $k | "\\(.[$k] | .image)"'"alpine:3.12" "gitlab/gitlab-runner-helper:x86_64-latest"
-
-
Run the same job, but this time set
FF_GITLAB_REGISTRY_HELPER_IMAGEtotrueeither in theconfig.tomlor when you start the pipeline. More information on how to enable a feature flag -
When the job is running, run the following command to check which help image was pulled
-
Find out pod running job from job trace
Running on runner-mkp1g3gh-project-20-concurrent-1hsw7h via steve-mbp-gitlab.local... -
kubectl get po/runner-mkp1g3gh-project-20-concurrent-0mxspm -o json | jq '.spec.containers | keys[] as $k | "\\(.[$k] | .image)"'"alpine:3.12" "registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-latest"
-
Test local import for Docker executor
-
Make sure you don't have the image locally with the name of
gitlab/gitlab-runner-helper:docker images -a | grep "gitlab-runner-helper" | awk '{print $3}' | xargs docker rmi -
Build image archive:
make helper-dockerarchive TAR_XZ="out/helper-images/prebuilt-x86_64.tar.xz" -
Run test that will import the image:
go test -ldflags (make print_ldflags) -run TestDockerCommandMultistepBuild -v ./executors/docker/ -
Check that the image is now imported by running
docker images | grep "gitlab-runner-helper". TheCreated Datedshould be in seconds/minutes since it was just created when you ran the test.gitlab/gitlab-runner-helper x86_64-34026ee0 2e0a58807cb2 47 seconds ago 64.4MB
What are the relevant issue numbers?
Phase 2 #27196 (closed)