Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bamboo YAML specs multiple plans of on repository - Change detection

Khaled Osman November 8, 2022

I was changing to use YAML Bamboo Specs and reached the below structure and the 3 plans are referring to 1 Repository: using !include 

/Project1
├── bamboo-specs
        ├── bamboo.yml
        ├── planA.yml
        ├── planB.yml
        └── planC.yml

I need to ask if there is a feature of "Path filter" as all plans A,B&C are triggered if just one file in the repo in a particular directory is changed which is not practical or the best scenario

So for example I need to specify when some change is done to trigger only one plan not all connected plans  

2 answers

1 accepted

1 vote
Answer accepted
Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 8, 2022

Hi @Khaled Osman

Welcome to Atlassian Community!

On the repository configuration, you can configure the Change detection options and add include or exclude file and message commit patterns that Bamboo can use to decide whether to trigger the build.

For example, adding a ^(bamboo-specs)\/.* to the exclude changeset will instruct Bamboo to ignore any commits to any files within the bamboo-specs folder. You will have to later scan the repository manually to effectively apply the changes.

As that's a regular expression, you can trick it to ignore all files but still accept one and then effectively trigger the build automatically. For example, the following regular expression:

  • ^((bamboo-specs)\/(?!bamboo\.yaml).*$)

Will ignore any commits to that folder, except for the bamboo.yaml file, so whenever you commit to that specific file, a build will happen.

Here's an example of the regex ignoring a commit to bamboo-specs/planA.yaml:

2022-11-08 23:56:59,636 INFO [14-repository-stored-specs:pool-17-thread-2] [RepositoryStoredSpecsExecutionServiceImpl] Bamboo Specs execution took 3.192 s
2022-11-08 23:56:59,668 INFO [15-BAM::SpecsDetection:pool-18-thread-1] [ImmutablePlanCacheServiceImpl] Invalidating specs state for ABC-EL
2022-11-08 23:56:59,675 INFO [AtlassianEvent::0-BAM::EVENTS:pool-1-thread-17] [BitbucketServerRssStatusUpdater] Sending RSS notification to Stash (repository: Elastic Specs)
2022-11-08 23:56:59,680 INFO [15-BAM::SpecsDetection:pool-18-thread-1] [AllTypesSpecsImporter] Bamboo Specs import took 3.275 s
2022-11-08 23:56:59,849 INFO [10-BAM::PlanExec:pool-12-thread-4] [DefaultChangeDetectionManager] : Excluded 1 file(s) from commit 508e7476d8bcbbf516a75988fd3e9335a16bbe44
2022-11-08 23:56:59,850 INFO [10-BAM::PlanExec:pool-12-thread-4] [ChangeDetectionListenerAction] No changes found for 'ABC-EL'

You can also exclude changesets by adding regular expressions that Bamboo will match as the commit message and will then bypass any builds.

For example, adding ^nobuild.*$ to the Exclude changesets will tell Bamboo that any commit message that starts with the word "nobuild" will be ignored.

2022-11-09 00:20:25,100 INFO [10-BAM::PlanExec:pool-12-thread-3] [DefaultChangeDetectionManager] : Excluding changeset '97057cb3eabbb2067fd546de11d994e4d63ed2b1' from change log.
2022-11-09 00:20:25,101 INFO [10-BAM::PlanExec:pool-12-thread-3] [ChangeDetectionListenerAction] No changes found for 'ABC-EL'

Thank you,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

Khaled Osman November 8, 2022

Thanks @Eduardo Alvarenga  for your reply 

But I see that, this is only a workaround, and every time I would work on Plan A, I will go to repo settings and exclude any trigger from the other plan directories and include only PlanA directory ?

but for example I would need on the same day to work on different plans in different directories and exclude and include commit message/specific file might not be the simple solution here 

Otherwise is the only solution to have a repo for each pipeline plan ?

Regards
Khaled

Eduardo Alvarenga
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 8, 2022

Hey @Khaled Osman

That's not a workaround. Bamboo can either accept or ignore certain files or commit messages and decide whether to initiate a build from there. As you are using a single repository to control various Plans, Bamboo has no way to distinguish what the users want to do and is bound to regular expressions.

As you need to work on various commits, probably from different teams, I'd suggest you agree with the developers on a codeword such as ^nobuild.*$ and add that to the Exclude changesets and don't set any file-specific include/excludes.

You can even add a negative regex such as ^(?!.*#buildnow[ ]?).*$ so any commit messages that have the "#buildnow" string on their commit messages trigger a build and any others won't.

Regards,

Eduardo Alvarenga
Atlassian Support APAC

--please don't forget to Accept the answer if the reply is helpful-- 

0 votes
Khaled Osman November 8, 2022

.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events