Skip to content

Predefined CI variables for the dependency proxy

Problem to solve

The dependency proxy is intended to be heavily used with CI. However users need to define their own variables or hardcode some values into their scripts.

Intended users

User experience goal

Provide some intuitive predefined variables for users to easily work with in CI scripts

Proposal

Although we can use many of the existing predefined variables like:

docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_SERVER_HOST":"$CI_SERVER_PORT"
docker pull "$CI_SERVER_HOST":"$CI_SERVER_PORT"/groupname/dependency_proxy/containers/alpine:latest

it would be better to use variables specific to the dependency proxy even if they are just aliases.

I propose the following variables:

  1. CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX the full group url with no protocol that could be found in the dependency proxy page for the group, for example: gitlab.com/groupname/dependency_proxy/containers
  2. CI_DEPENDENCY_PROXY_USER (alias of CI_REGISTRY_USER)
  3. CI_DEPENDENCY_PROXY_PASSWORD (alias of CI_REGISTRY_PASSWORD)
  4. CI_DEPENDENCY_PROXY_SERVER for use in docker login, the base host with no protocol, but including the port

This would allow the above commands to be used like:

docker login -u "$CI_DEPENDENCY_PROXY_USER" -p "$CI_DEPENDENCY_PROXY_PASSWORD" "$CI_DEPENDENCY_PROXY_SERVER"
docker pull "$CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX"/alpine:latest

The CI_DEPENDENCY_PROXY_GROUP_URL variable being the most beneficial since it is not possible to build it using other existing variables.

Edited by Tim Rizzi