[UPDATE Dec 14, 2020] - please see my comment to see how I worked around this.
Hey guys, thanks for the help.
I have 2 plans.
1st plan is triggered by any commits to my development branch. It checks for changes and changes version numbers in a version file and then commits the new version numbers back up to Bitbucket.
2nd plan checks out all the code (including new version number file) and builds and deploys my code bundle.
I have the first plan set to trigger on any commit EXCEPT commits that contain "[ci]" in the commit message, which is what I use to commit the version number changes. This is to prevent infinite looping. This is using Plan Config -> Repositories -> "Change Detection Options" -> "Exclude Changesets" -> with the regex .*\[ci\].*
I want the second plan to trigger only when commits to the same repo CONTAIN "[ci]" in the commit message (ex: "[ci] revving version numbers"). Note, I can't do this all in one Plan because then the re-checkout uses the initially checked commit hashes, not the updated one. And I can't use Plan dependencies to trigger the second build because it also will use the same commit hashes as first plan. I tried using the negative/inverse regex in the "Exclude Changesets" section by writing .*\[ci\].*\n but this also does not work.
As it is right now, my second plan gets triggered twice, once on the normal commit to the dev branch, and again, when my first plan commits to dev branch. I need it to only trigger that second time.
I have seen people mention inverse regex, but I tried this and it does not work.
I have seen people recommend Script Runner, but I'd prefer to avoid buying extra licenses if possible. Has anyone else had success with this plugin though? If so, maybe I will look into it again if we can't solve this another way.
Please advise. Cheers
A bit late but... I found a solution. You need to put a "negative" regular expression in the "Exclude changesets" section in the repository configuration, that include the word that you want.
The regular expression is like :
^(?!.*test).*$
with this, bamboo will only build commits with this word in the message
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So, I was able to get 'solve' this problem.
This setup no longer runs the second plan twice, and I don't have to worry about negative regex because I am using the Child Plan setup. Because I am using custom scripts to checkout code, I am not using Bitbucket's repository caching, which is why everything works now.
Hope this helps guys!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Better DevOps Automation gives an elegant solution to this.
Create an automation rule:
It's rather straightforward.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey Aron, this looks like an awesome option if I was allowed to install extensions! Unfortunately I cannot do that.
Thanks for sharing this though :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.