4

Using the drone docker plugin in order to create my cloud images, I would like to simplify the workflow by having drone automatically tagging my images depending of the git branch name I'm working with.

I saw a auto_tag but unfortunately it always tag my images as "latest".

###
 # 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]

has anyone tried to do something similar?

I'm using drone 0.8

Jay Cee
  • 1,855
  • 5
  • 28
  • 48

1 Answers1

8

The auto_tag uses the repository/git tags seems to me you are looking to set custom docker image tags.

You can use any of these variables http://docs.drone.io/environment-reference/

Try using DRONE_COMMIT_BRANCH

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