Support tag not semantic version when using docker plugin auto_tag

#1

Hi, all

I use plugins/docker to build docker image, but i found the image the final tag is 0.1.0-alpha1 when my tag like v0.1.0-alpha1, i hope the docker plugin use v0.1.0-alpha1 as image tag.

I don’t know why the docker plugin not support it, because i remember plugin support it before. Maybe i missing something, so if someone know, hope can tell me. Thanks.

#2

auto-tagging strips the “v” from the tag prefix.

#3

Yes, i see the docker plugin code, it use semantic version.
I use tags parameter, like this tags: [ "${DRONE_TAG}" ], the docker plugin not works. But when i add debug: true, it works. I don’t know why.

#4

If you are using auto_tag you should not be settings tags manually.

Here is an example of how we use auto_tag for drone https://github.com/drone/drone/blob/master/.drone.yml#L32:L46

#5

Thanks, I remove tags and only use auto_tag, it’s OK. if my tag is v0.1.0, the image tag is 0.1.0, but I hope the image tag is the same as git tag, so I try the tags, but if I not set debug, it’s not work.

#6

auto-tag is very opinionated and uses best practices for tagging images, based on how the official dockerhub images are tagged. Auto-tag therefore may not be a good fit for every project.

#7

auto-tag is good, but i have some project use not semantic version use as git tag, so i can’t use this configuration, i have to use tags instead of auto_tag, but when i use tags, it not work.

- name: build
  image: docker.cloud/plugins/docker
  settings:
    dockerfile: Dockerfile
    force_tag: true
    insecure: true
    password:
      from_secret: docker_password
    registry: docker.cloud
    repo: docker.cloud/kubernetes/node-pool-operator
    tags:
    - "${DRONE_TAG}"
    username:
      from_secret: docker_username
  privileged: true
  when:
    event:
    - tag

If i want this pipeline works, i must setting debug: true in settings, i don’t know where is wrong. Can you tell me if you have time?