gitlab - CI_APPLICATION_TAG 在 GItLab 中定义在哪里?

标签 gitlab gitlab-ci-runner

我是 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 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

此外,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

与:

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

关于gitlab - CI_APPLICATION_TAG 在 GItLab 中定义在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56746506/

相关文章:

docker - GitLab runner docker executor 通过 IP 地址回调 gitlab 服务器

github - 访问 Github wiki/Markdown 中登录的用户名

GitLab 缓存无法可靠地找到匹配的文件

git - Gitlab CI运行程序无法在docker executor上共享构建源

maven - 如何为 GitLab CI 运行器启用 Maven Artifact 缓存?

c# - 在框架 "netcoreapp2.0"和 RID "debian.8-x64"上使用 PostSharp 构建错误

continuous-integration - 基于正则表达式的规则子句在 GitLab CI 中不起作用

docker - 无法使用 Kubernetes 执行器访问 gitlab runner 中的 docker 守护进程

ruby-on-rails - GitLab LDAP 次要策略

gnupg - GitLab CI 上的 Blackbox,无法加载 GPG 私钥