Where is CI_APPLICATION_TAG define in GItLab?

Viewed 2500

I am new to GitLab Auto DevOps.

I encountered some environment variables which are "CI_APPLICATION_TAG"、"CI_APPLICATION_REPOSITORY"、"CI_COMMIT_REF_SLUG".

I can't find where their definitions are. Is there anyone can help me?

2 Answers

You can see them in action in gitlab-org/gitlab-ci-yml issue 50

The Docker image naming strategy in Auto DevOps is defined via the CI_APPLICATION_REPOSITORY and CI_APPLICATION_TAG variables near the start of the auto_devops before_script.
The format differs from the way I name and tag images, but the inline export statements make it difficult to customize since the script itself has to be modified.

export CI_APPLICATION_REPOSITORY=$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG
export CI_APPLICATION_TAG=$CI_COMMIT_SHA

Also, gitlab-org/gitlab-ce issue 53129

For building Docker images in a project, GitLab CI provides the predefined variable CI_REGISTRY_IMAGE that returns the base image name for images stored the Container Registry tied to the project.

This can be be used in conjunction with CI_COMMIT_REF_NAME or CI_COMMIT_REF_SLUG for the image tag.

The Docker.gitlab-ci.yml template demonstrates this in its build job script.

- docker build --pull -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG"

GitLab Auto DevOps declares two local variables in its before_script for the image name and tag.

export CI_APPLICATION_REPOSITORY=$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG
export CI_APPLICATION_TAG=$CI_COMMIT_SHA

With:

  • CI_APPLICATION_REPOSITORY is used to define the image name, and
  • CI_APPLICATION_TAG for the image tag
Related