Drone Docker build fails on tag

I’m using drone 1.1.0 with Gogs and have a definition like this:

kind: pipeline
name: default

- name: docker
  image: plugins/docker
  settings:
    username:
      from_secret: docker_username
    password:
      from_secret: docker_password
    target: production
    auto_tag: true
    repo:
      from_secret: docker_repo
    registry:
      from_secret: docker_registry

The build succeeds on a regular commit. But when I create a tag (e.g. 0.3) and push it, the build fails with the following message:

WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
+ /usr/local/bin/docker build --rm=true -f Dockerfile -t . --pull=true --target production --label org.label-schema.schema-version=1.0 --label org.label-schema.build-date=2019-05-09T14:24:18Z --label org.label-schema.vcs-ref= --label org.label-schema.vcs-url=https://{redacted-server}/********/drone-ci-test.git
invalid argument "" for "-t, --tag" flag: invalid reference format
See 'docker build --help'.
time="2019-05-09T14:24:18Z" level=fatal msg="exit status 125"

I get the same error when I omit auto_tag: true. Any ideas?

I also tried to include debug: true which yields no additional info. Also: when I add

when:
  event: tag

and execute it locally with drone exec after I create a local git tag, the step is not executed.

I can confirm this issue as well - same everything.

the auto_tag feature strictly requires semver. If you are no using semver you should manually specify the tag using the tags attribute in the yaml.

when you run drone exec locally you need to use the --event flag to tell drone which event to use. For example, drone exec --event=tag.

I tried to create a git tag with semantic versioning 0.3.0 and executed it locally with the --event=tag flag. Now my docker step gets executed, but it is just creating a latest tag with auto_tag: true in the repository. Only when I explicitly specify my version in tags and omit auto_tag the version is used. I also tried using tags: ${DRONE_TAG} which yields Error parsing reference: "********:" is not a valid repository/tag: invalid reference format.

I think there is an issue where Gogs does not work with autotag due to lack of commit sha being provided in the Gogs payload [1]. This may also impact Gitea since it is a fork of Gogs, although I think the Gitea folks patched this recently.

But otherwise, you will find that we use auto_tag for Drone and all Drone plugins. Looking at some real-world configurations may be useful [2][3]

[1] https://github.com/drone-plugins/drone-docker/issues/229
[2] https://github.com/drone/drone/blob/master/.drone.yml
[3] https://github.com/drone-plugins/drone-slack/blob/master/.drone.yml

FWIW I’ve switched to Gitea which works fine with tags.