Make configuration of helper image dynamic
Currently the correlation between a release of gitlab-runner and the specific version is made using the tag of the helper image. This is done by including the commit id of the relaase in the tag, but only when the option
helper_image is not set.
A lot of my customers don't allow direct access to DockerHub, but have some cache like artifactory acting as a gateway. For these setups, you need to configure the helper_image to use a mirror in the cache. But this arises the need for a config every time a new gitlab-runner version is released.
The other problem is, that we usually want to run the latest version of gitlab-runner which does not do well with this mechanism. But can't use the latest version of the image, because when the runner instance is running for a long time, the latest helper image version can be newer and potentially breaking.
For this issue I have two possible solutions:
- Add a prefix configuration, which will be applied to the helper image location.
- Make the
helper_imageoption dynamic. If you configure it like this:
helper_image = "my-docker-cache.example.com/gitlab/gitlab-runner-helper:$VERSION"
The $VERSION will be replaced by the needed revision, like currently done when no option is set.
Links to related issues and merge requests / references
A good start for this change would be the
GetHelperImage-Function at https://gitlab.com/gitlab-org/gitlab-runner/blob/master/common/config.go#L320