Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,367,189
Community Members
 
Community Events
168
Community Groups

Does the Bamboo REST API allow me to update the Change Detection options

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.

1 answer

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

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.

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

I am using Java Specs.

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

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;
    }

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

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.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events