Two builds fire and tagged event is empty

Trying to setup a step to only trigger when the master branch is tagged, but when I tag master and push the the tag, two builds are triggered. The other thing I’m scratching my head on is, the only step in the tagged event build, is clone

pipeline:
  step:
    image: alpine
    commands:
      - echo "Master has been tagged"
    when:
      branch: master
      event: tag

When I tag master and push the the tag, two builds are triggered

Drone can only trigger a single build per webhook received from version control (eg GitHub). If multiple builds are triggered it would indicate multiple webhooks are being sent, in error, from version control.

the only step in the tagged event build, is clone

That when condition will never evaluate to true. You cannot specify a branch name for tag events because git tags are pointers to a commit sha, not a branch. A single commit can be pointed to by multiple branches or no branches; branches can be deleted or renamed or local only.

You will therefore need to remove the branch from the condition:

    when:
-     branch: master
      event: tag
1 Like

@bradrydzewski This makes total sense. Thanks for explaining that

@bradrydzewski That doesn’t make sense, as this is specified in your documentation here (" Execute a step if the build event is a tag created from the specified branch:": http://docs.drone.io/conditional-steps/. My team was working on this for several hours before discovering this post. Please edit the docs to be correct!

sorry, but I’m not sure what exactly you find confusing about the docs, but if you think the documentation could be improved please consider sending a patch to https://github.com/drone/docs

1 Like