Skip to content

Uploading artifacts from custom build image failes in Kubernetes

Description

Uploading artifacts from a build run by an custom runner image like golang:1.7 fails with

Missing /usr/bin/gitlab-runner-helper. Uploading artifacts is disabled.

The root cause of this is that the kubernetes executor does not create a predefined container like the docker executor. Thus all commands are executed in the user-provided custom image. Thus the custom image has to provide all helper binaries.

Proposal

There are two approaches to solve this problem.

  1. Provide all required binaries (gitlab-runner-helper) and other scripts as downloadable artifact. Thus the people can incorporate them into their custom runner images. Also add documentation about the required settings and binaries in a custom runner image.

  2. Change the kubernetes executor logic to create a second predefined container in the build pod. This would match the behaviour of the docker executor. Since kubernetes relies on a docker registry to pull images, the prebuilt image have to be provided via an public accessible docker registry (like docker hub). Furthermore I propose to make the image configurable in the runner config. Thus people can cache is image in an private registry.

Links to related issues and merge requests / references

This issue was brought up in #1673 (closed) which is closed by now.

Here is the code to run any script command: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/executors/kubernetes/executor_kubernetes.go#L99

The pod is created at this line of code https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/blob/master/executors/kubernetes/executor_kubernetes.go#L156