I have spent 3 hours banging my head figuring out why I can’t trigger a job by it’s tag. My ideal scenario is following.
- I do the work on local repo
- I proceed to commit my work and tag them with semantic versioning (e.g. I’m tagging this commit by
1.0.5-release
. - I push both main branch and tag like so:
git push --atomic origin main 1.0.5-release
. - I want drone to only build from tag
1.0.5-release
and leave out main branch.
But what actually happen is, drone will not even trigger when I push the tag. This is my drone.yml
---
kind: pipeline
type: docker
name: publish
clone:
depth: 1
steps:
- name: upload
image: plugins/docker
settings:
registry: priv.registry.com
repo: priv.registry.com/gugel/project
dockerfile: docker/Dockerfile
context: docker
auto_tag: true
purge: true
username:
from_secret: GIT_USERNAME
password:
from_secret: GIT_PASS
- name: notify
image: priv.registry.com/gugel/sendwa
settings:
wa_token:
from_secret: ONESENDER_TOKEN
wa_recipient: 12345,678901
repo_name: DRONE_REPO_NAME
timestamp: DRONE_BUILD_STARTED
commit_issuer: DRONE_COMMIT_AUTHOR
commit_message: DRONE_COMMIT_MESSAGE
commit_url: DRONE_COMMIT_LINK
trigger:
ref:
- refs/tag/*-release
event:
- tag
But I also discovered something, if I change the ref property from from refs/tag/*-release
to *-release
only, apparently it will trigger drone to start a jobs, but it failed instantly with following error.
If anyone can shed some light to this problem, I will be very glad.