【问题标题】:Drone.io auto_tag with branch name带有分支名称的 Drone.io auto_tag
【发布时间】:2018-02-13 15:54:33
【问题描述】:

使用drone docker插件来创建我的云图像,我想通过让drone根据我正在使用的git分支名称自动标记我的图像来简化工作流程。

我看到了一个 auto_tag,但不幸的是它总是将我的图像标记为“最新”。

###
 # Tag deployment
 # Docker image
###
push-tag-news:
  image: plugins/docker
  registry: docker.domain.com:5000
  secrets: [docker_username, docker_password]
  repo: docker.domain.com:5000/devs/news
  auto_tag: true # Or how to specify the current branch for the tags: option?
  when:
    exclude: [master, dev]

有没有人尝试做类似的事情?

我正在使用无人机 0.8

【问题讨论】:

    标签: drone.io


    【解决方案1】:

    auto_tag 使用存储库/git 标签在我看来您正在寻找设置自定义 docker 图像标签。

    您可以使用这些变量中的任何一个http://docs.drone.io/environment-reference/

    尝试使用DRONE_COMMIT_BRANCH

      build-docker-image:
        image: plugins/docker
        repo: myname/myrepo
        secrets: [ docker_username, docker_password ]
        tags:
          - ${DRONE_COMMIT_BRANCH}
          - latest
    

    【讨论】:

    • 我不知道为什么,但我无法完全理解他们的文档。非常感谢!
    猜你喜欢
    • 2018-04-11
    • 2022-01-19
    • 2019-11-20
    • 1970-01-01
    • 1970-01-01
    • 2020-09-21
    • 2023-02-20
    • 2022-08-02
    • 2016-02-02
    相关资源
    最近更新 更多