gitlab-ci - Gitlab CI - $CI_COMMIT_TAG 为空
问题描述
构建时,我需要在我的 gitlab-ci.yml 中上次推送的 git commit 的标记值。在构建过程中,我构建了一个 docker 镜像,在构建之后,我想推送这个带有与我的 git 提交相同标签的镜像。到目前为止,我的理解是环境变量$CI_COMMIT_TAG
应该完成这项工作。然而,当我$CI_COMMIT_TAG
在我的 gitlab-ci.yml 中回显时,它只是空的。
这是我的 gitlab-ci.yml:
stages:
- build
build-dev:
stage: build
environment: development
only:
- master
tags:
- ms-doorman
script:
- echo $CI_COMMIT_TAG
这里是启动工作的 git 命令。
$ git commit -am "test git tags"
$ git tag test-tag
$ git push --tags origin master
解决方案
推荐阅读
- javascript - JS 构造函数正在输出未定义的值
- java - JavaFX:ObservableListWrapper 无法转换为 TableView 中的类
- jquery - MVC 中的 Jquery ajax POST 调用 - 包括 IIS 中托管的应用程序名称
- javascript - 如何在 php 和 mysql 上实现数据表
- angular - “UpdateEmployeeComponent”类型上不存在属性“已提交”
- android - 在 Glide 库中加载字符串本地地址
- html - 为什么我的主要内容与 Blazor Syncfusion 中的粘性顶部栏重叠?
- android - 应用关闭时从网站接收数据
- docker - Docker - Micronaut 项目抛出:未找到嵌入式容器
- c# - Mongo 数据库连接问题