As mentioned in one of the previous posts that Bitbucket Serve does not include the commit message in the webhook payload because of that execution step can’t be skipped.
I was thinking to make use of Conditions or Triggers. In docs I saw that we can use “exclude” property.
I tried implementing both
1- Triggers
steps:
- name: NAME
image: node:12.16.2-alpine
commands:
- git tag -a CIDrone -m "to skip the execution"
- git push --follow-tags origin BRANCH
trigger
branch:
- release/dev
event:
- push
ref:
exclude:
- refs/tags/CIDrone
As I understand, this should be on step level, not pipeline level.
2- Conditional
steps:
- name: NAME
image: node:12.16.2-alpine
commands:
- git tag -a CIDrone -m "to skip the deployment"
- git push --follow-tags origin release/dev
when:
ref:
exclude:
- refs/tags/CIDrone
Pushing tags, in either case, triggers the execution and ends up in in-finite loop scenario.
What I want to achieve is, I need to push tags to git branch while the pipeline is running, as a trigger of the pipeline is push, it starts executing again, which I don’t want of course.
Is there any better approach?
Does my understanding of exclude is wrong?
I am not sure I fully understand the question, however, if you want to ignore tags you would add the following section to your yaml:
trigger:
event:
exclude:
- tag
or instead of excluding tags, you could include specific events you want the system to process:
trigger:
event:
- push
- pull_request
If you see a pipeline execute and this is not expected, you should post a copy of your yaml and a copy of the build information). These issues are generally caused by misconfiguration, so we need to see both the yaml and the build information to help you correct your pipeline configuration.
In simple words, I want to skip the execution when specific tag available in the branch.
In my yaml code above “git tag -a CIDrone -m "to skip the deployment” adds the tag into the branch, and on the base of this tag, I want drone not to execute it.
As [ci skip] is not working. I want an alternative.
Sorry this is not possible. I think there is perhaps some confusion around how the include and exclude logic works and what it means, so I will try to clarify.
You instruct Drone to skip pipeline execution if the reference in the webhook payload (example here) matches any of the references in the exclude list. Here is some simple pseudo code that demonstrates how this is evaluated: