Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Drone.io auto_tag with branch name

Tags:

drone.io

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

like image 528
Jay Cee Avatar asked Oct 30 '25 01:10

Jay Cee


1 Answers

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
like image 54
Everton Yoshitani Avatar answered Nov 02 '25 11:11

Everton Yoshitani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!