Does the Bamboo REST API allow me to update the Change Detection options
Asked by Terry Ninnis:

When I set the Include/Exclude files dropdown to "Include only changes that matches to the following pattern", I want to update the associated File Pattern.

I want to update the Change Detection options from the Bamboo REST Api if possible.


Answers:
author: Daniel Santos
body: Hi Terry,  

I suggest you using Bamboo Java repository specs. This is how you can create a plan with this feature: [Tutorial: Bamboo Java Specs stored in Bitbucket Server - Atlassian Documentation](https://confluence.atlassian.com/bamboo/tutorial-bamboo-java-specs-stored-in-bitbucket-server-938641946.html).

Once you have a plan in this format you should be able to change the file pattern by performing commits into the plan configuration repository. As soon as Bamboo detects the change in the plan configuration, the file pattern will be updated.

In case you want to understand more about Bamboo specs, please check this page: [Bamboo Specs - Atlassian Documentation](https://confluence.atlassian.com/bamboo/bamboo-specs-894743906.html).

At the moment of this answer, Bamboo does not have a REST api endpoint to update this configuration.

comments: author: Terry Ninnis
body: I am using Java Specs.

The plan I am using uses a Linked Repo called TRYMEsecond.

![Capture.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/39403i2D16B6835613F3BD/image-size/large?v=v2&px=999 "Capture.PNG")

That Linked Repo has the required pattern in it (i.e. \^(Second).\* ) but I cannot see the value of the file pattern in the java spec:

public Plan plan() {  
final Plan plan = new Plan(new Project()  
.oid(new BambooOid("t3bp047ej285"))  
.key(new BambooKey("TRY"))  
.name("try"),  
"Second",  
new BambooKey("SEC"))  
.oid(new BambooOid("t31zsiu6pd1i"))  
.pluginConfigurations(new ConcurrentBuilds()  
.useSystemWideDefault(false))  
.stages(new Stage("Default Stage")  
.jobs(new Job("Default Job",  
new BambooKey("JOB1"))  
.tasks(new VcsCheckoutTask()  
.description("Checkout Default Repository")  
.checkoutItems(new CheckoutItem().defaultRepository()))  
.requirements(new Requirement("system.builder.command.Cygwinbatch"))))  
.linkedRepositories("TRYMEsecond")  

.triggers(new BitbucketServerTrigger())  
.planBranchManagement(new PlanBranchManagement()  
.createForVcsBranch()  
.delete(new BranchCleanup()  
.whenRemovedFromRepositoryAfterDays(7)  
.whenInactiveInRepositoryAfterDays(30))  
.notificationForCommitters());  
return plan;  
}


author: Terry Ninnis
body: On further examination I have found the the change detection code is exported to the "View plan as Java Specs" screen IF the Repository is a Plan Repository but NOT a Linked Repository.

Strangely, the Change Detection settings are honoured as part of the Linked Repository.

Atlassian has warned that the Plan Repositories are being deprecated soon and Bamboo will always default to a Linked Repository.

Is that feature available in any version (we are on 6.4.1)?

Will the ChangeDetection continue to work?

We used Linked Repositories because every solution had its own repo so any change triggered a build.

Now we are using mon-repos, we need specific paths to rigeer the Build Plan.

To summarise:

Plan using Linked Repository has this:

**.linkedRepositories("Data.Core")**

Plan using Plan Repository has this:

**.planRepositories(new BitbucketServerRepository()**   
**.name("Data.Core")**   
**.oid(new BambooOid("\*\*\*"))**   
**.repositoryViewer(new BitbucketServerRepositoryViewer())**   
**.server(new ApplicationLink()**   
**.name("\*\*\*")**   
**.id("\*\*\*"))**   
**.projectKey("LEG")**   
**.repositorySlug("data.core")**   
**.sshPublicKey("\*")**   
**.sshPrivateKey("\***   
**.sshCloneUrl("\*\*\*")**   
**.changeDetection(new VcsChangeDetection()**   
**.filterFilePatternOption(VcsChangeDetection.FileFilteringOption.INCLUDE_ONLY)**   
**.filterFilePatternRegex("Includeme")))**   

And we cannot do this:

**.linkedRepositories("Data.Core")**

**.changeDetection(new VcsChangeDetection()**   
**.filterFilePatternOption(VcsChangeDetection.FileFilteringOption.INCLUDE_ONLY)**   
**.filterFilePatternRegex("Includeme"))**

It will be important for us to know where we are on this


author: Daniel Santos
body: Hi Terry,

You are correct, you need plan repositories for this.

At the moment of this message, we don't have plans to remove plan repositories. On recent Bamboo versions we have created mechanisms to encourage users to configure and convert plan repositories to linked ones. We understand that using linked repositories simplifies the server configuration, reduces the amount and complexity of DB data and also helps on updating repository details in just one place.
> Is that feature available in any version (we are on 6.4.1)?

You should be able to use this plan repositories and update them through specs from your version to the latest version of Bamboo.
> Will the ChangeDetection continue to work?

It works for newer version and AFAIK it will keep that way.


Tags: rest-api