Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-21987

Specs branches are created as normal plan branches intermittently for specs repositories if there is more than one repository with specs enabled created for the same Bitbucket repository.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Low
    • None
    • 8.1.8
    • Bamboo Specs
    • None

    Description

      Issue Summary

      Creating a VCS branch in Bitbucket for a linked Bitbucket repository configuration with specs enabled in Bamboo creates a normal plan branch sometimes in Bamboo rather than a specs branch(divergent branch) if there is more than one repository created in Bamboo for the same Bitbucket repository with specs enabled option. And if only one of those repositories is linked to Plan published through specs as a linked repository.

      This is observed in Java specs.

       

      This is reproducible on Data Center: Yes

      Steps to Reproduce

      Make sure to have an application link created between Bitbucket and Bamboo before continuing.

      1. Create a repository in Bitbucket (e.g. repo1).
      2. Create a linked repository in Bamboo pointing to the repository created in the previous step (e.g. repo1).
        • Enable Bamboo Specs in the repository configuration and give it the following access Project creation allowed, Access all projects and Access all repositories.
      3. Create a project in Bamboo named PROJ with key PROJ.
      4. Create a bamboo-specs folder inside your repository's root and the Planspec.java file with a sample specs plan configuration following the below document.
      5. Also configure a linked repository with a Bitbucketserverrepository trigger through Bamboo specs through the above repository(repo1) and with plan branch management. Below is the sample Java specs code:
        •    Plan createPlan() {
                  return new Plan(project(), "My Plan", "PLAN")
                          .description("Plan created from Bamboo Java Specs")
                          .stages(
                                  new Stage("Stage 1")
                                          .jobs(new Job("Run", "RUN")
                                                  .tasks(
                                                          new ScriptTask().inlineBody("echo Hello world!"))))
                          .linkedRepositories("repo1")
                          .triggers(new BitbucketServerTrigger())
                          .planBranchManagement(new PlanBranchManagement()
                              .createForVcsBranch()
                              .delete(new BranchCleanup().whenInactiveInRepositoryAfterDays(60)));
          
      6. Publish the plan configuration into Bamboo by scanning the specs repository created above.
      7. This will create a Plan "PLAN" under the "PROJ" project and you should see a build triggered for this plan.
      8. Now create another linked repository in Bamboo pointing to the same repository created in the first step (e.g. repo2).
        • Enable Bamboo Specs in the repository configuration.
      9. At this stage you have two linked repositories pointing to the same Bitbucket (Server or Data Center) repository and with Specs enabled.
      10. Scan this repository (repo2) and it will define the plan configuration.
      11. Now, create a VCS branch in the Bitbucket repository which is configured to these linked repositories with specs enabled.
      12. It will create a normal plan branch instead of a specs branch in Bamboo.

      Expected Results

      Bamboo should create the branch as a specs branch when it is coming from the repository configuration with specs enabled.

      Actual Results

      Bamboo created a branch as a normal plan branch instead of a divergent branch.

      There are no errors or exception thrown in atlassian-bamboo.log file

      I have tested this scenario in my test environment and the same behaviour is observed. If there are multiple specs-linked repositories created for the same Bitbucket repository, and the plan gets scanned/published through more than one repository.

      If the plan got published through a repository other than the linked repository defined in the plan configuration it will consider the branch creation as a normal plan branch.

      The plan branch will be created as a "specs branch" if the linked repository which is configured in the plan and the repository through which plan specs got scanned are the same.

      Workaround

      In order to fix the issue, remove the "duplicate" linked repository in Bamboo that has Specs enabled and make sure to have only one linked repository with specs enabled to publish the plan configuration.

      Attachments

        1. specsbranch.png
          specsbranch.png
          380 kB
        2. planbranch.png
          planbranch.png
          397 kB

        Issue Links

          Activity

            People

              Unassigned Unassigned
              dac6e1c9d0b2 Jyothi Charupalli
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated: