No $HOME set in gitlab runner
When executing a build using the version 13.8.0, the build cannot write to the home directory. Instead, it tries to write to the / folder and fails. This used to work on older versions (October 2020?) of the openshift gitlab-runner.
The following gitlab-ci.yaml can be used to reproduce:
stages:
- reproduce_bug
Job:
stage: reproduce_bug
image: gcr.io/k8s-skaffold/skaffold:latest
before_script:
- kubectl config set-credentials deployer-account --token="somevalue"
script:
- echo success!
Which resulted in the following log:
Running with gitlab-runner 13.8.0 (775dd39d)
on xxx-build-runner-74878cfd48-fvrjl VwJxysX4
Preparing the "kubernetes" executor
00:00
Using Kubernetes namespace: xxx-gitlab-runners
WARNING: Pulling GitLab Runner helper image from Docker Hub. Helper image is migrating to registry.gitlab.com, for more information see https://docs.gitlab.com/runner/configuration/advanced-configuration.html#migrating-helper-image-to-registrygitlabcom
Using Kubernetes executor with image gcr.io/k8s-skaffold/skaffold:latest ...
Preparing environment
Waiting for pod xxx-gitlab-runners/runner-vwjxysx4-project-9350-concurrent-0kkbwc to be running, status is Pending
Waiting for pod xxx-gitlab-runners/runner-vwjxysx4-project-9350-concurrent-0kkbwc to be running, status is Pending
ContainersNotReady: "containers with unready status: [build helper]"
ContainersNotReady: "containers with unready status: [build helper]"
Running on runner-vwjxysx4-project-9350-concurrent-0kkbwc via xxx-build-runner-74878cfd48-fvrjl...
Getting source from Git repository
00:01
Fetching changes with git depth set to 50...
Initialized empty Git repository in /builds/supportresource/debug-gitlab-runners/.git/
Created fresh repository.
Checking out 0d9bdfca as master...
Skipping Git submodules setup
Executing "step_script" stage of the job script
00:00
$ kubectl config set-credentials deployer-account --token="somevalue"
error: mkdir /.kube: permission denied
Cleaning up file based variables
00:00
ERROR: Job failed: command terminated with exit code 1