相关疑难解决方法(0)

Gitlab CI - $CI_COMMIT_TAG 为空

构建时,我需要在 gitlab-ci.yml 中上次推送的 git commit 的标签值。在构建过程中,我构建了一个 docker 镜像,在构建之后,我想推送这些镜像,其标签与我的 git commit 相同。到目前为止,我的理解是环境变量$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
Run Code Online (Sandbox Code Playgroud)

这里是启动作业的 git 命令。

$ git commit -am "test git tags"
$ git tag test-tag
$ git push --tags origin master
Run Code Online (Sandbox Code Playgroud)

gitlab-ci gitlab-ci-runner

5
推荐指数
1
解决办法
7555
查看次数

标签 统计

gitlab-ci ×1

gitlab-ci-runner ×1