我是 GitLab Auto DevOps 的新手。
我遇到了一些环境变量,它们是“CI_APPLICATION_TAG
”、“CI_APPLICATION_REPOSITORY
”、“CI_COMMIT_REF_SLUG
”。
I can't find where their definitions are. Is there anyone can help me?
最佳答案
您可以在 gitlab-org/gitlab-ci-yml
issue 50 中看到它们的实际效果
The Docker image naming strategy in Auto DevOps is defined via the
CI_APPLICATION_REPOSITORY
andCI_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
此外,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
orCI_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
与:
CI_APPLICATION_REPOSITORY
is used to define the image name, andCI_APPLICATION_TAG
for the image tag
关于gitlab - CI_APPLICATION_TAG 在 GItLab 中定义在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56746506/