Atlassian Bamboo: don't trigger build if changes were made to a specific file
Asked Answered
M

2

9

I have a plan in Bamboo that starts whenever changes are made to the attached repositories (via polling).

Now, on each build, if successful, a CHANGELOG file is updated in the repo, which in turn, triggers another build. How can I omit certain files from Bamboo's polling, so that a build isn't started if changes are found for those files? Because otherwise, I enter in infinite loop, with a change to CHANGELOG triggering another build which in turn updated CHANGELOG and so on.

If this is not possible, what other viable solutions are there? Is it possible to attach a shell script somewhere before the build starts to check whether it's desired to start a new build?

Mammary answered 8/4, 2014 at 8:15 Comment(0)
M
11

It turned out that this was simpler than I've thought. In Plan Configuration, in the Repositories tab, on each repository, under Advanced, there is an Include / exclude files input where you can Customise what files Bamboo uses to detect changes. By adding a regular expression there, I got everything solved and working as expected.

Bamboo pattern matching reference: https://confluence.atlassian.com/display/BAMBOO/Pattern+matching+reference

Mammary answered 7/5, 2014 at 12:51 Comment(1)
Wait. So is this a java/posix regex or just an ant pattern? My Bamboo 6.10.4 says regex while you're pointing me to ant syntax.Springwood
O
2

The Bamboo Documentation says:

Bamboo will ignore build triggers if the local working copy and the repository copy have the same revision numbers.

This might not be the best solution, but you might add an additional task at the end of the job/build which updates the repository again to avoid triggering a new build.

I'm not sure if this would then skip builds from repository updates which occur during the current build.

Overcritical answered 8/4, 2014 at 9:37 Comment(3)
It is a good idea, but unfortunately, two issues arise: builds are still triggered if commits happen while a build is in progress and by adding an additional source code checkout task in the end of the job, test results are removed hence the junit parser task fails resulting in a failed build.Mammary
I don't fully understand the first issue. Why is this a problem? And canno't you run the additional source code checkout after the junit parser task?Overcritical
The first issue is the one you've mentioned in your last phrase. If I commit something from the current build, another one will be triggered no matter if I add an extra source code checkout task before the job ends. Regarding the other one, no, I can't, because when I do the second source code checkout, everything is removed (since I must force a clean build) and so are the test results. Without results to parse, the junit task fails and so does the build.Mammary

© 2022 - 2024 — McMap. All rights reserved.