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

Deployment release fails trying to download artifact from wrong branch when using Bamboo Specs

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Low
    • 7.2.0, 7.1.1
    • 7.0.2, 7.0.4
    • Artifacts
    • None

    Description

      Issue Summary

      After Bamboo 7.x every new plan branch created in a plan using Bamboo Specs is a divergent branch and has its own separate configuration in the database. Bamboo is switching the branch where a deployment project should be trying to get artifacts from every time a new plan branch is created using Bamboo Specs in the source build plan. This wasn't a problem before 7.x because all plan branches were inheriting the same configuration from the main plan branch.

      This renders deployment releases to fail because a new plan branch can have a completely different set of tasks and artifact definition compared to the main plan branch (usually named master).

      Steps to Reproduce

      1. Install Bamboo 7.0.x.
      2. Integrate it with Bitbucket Server.
      3. Create a project named Bamboo with key BAM in Bamboo.
      4. Use the following RSS Bamboo YAML Specs:
        bamboo.yaml
        ---
        # Build plan
        version: 2
        plan:
          project-key: BAM
          name: Bamboo Specs
          key: SPECS
        
        branches:
          create: for-new-branch
        
        stages:
          - Default Stage:
              jobs: 
                - Build
        Build:
          tasks:
            - script:
                - echo hello > test.txt
          artifacts:
            - name: test.txt
              pattern: test.txt
              shared: true
              required: true
        
        ---
        version: 2
        deployment:
          name: deployment
          source-plan: BAM-SPECS
         
        release-naming: release-1
         
        environments:
          - Production
         
        Production:
          triggers:
            - build-success
          tasks:
            - clean
            - artifact-download
            - script:
                - echo hello
        
      1. Create a repository configuration in Bamboo pointing to your Bitbucket Server repository storing the bamboo-specs/bamboo.yaml file.
      2. Scan the repository in Bamboo to create (a) build plan and (b) deployment project.
      3. The build plan and deployment project will be created and automatically triggered.
      4. Create a new branch in your Bitbucket Server repository and modify the yaml file to remove the artifact definition:
        bamboo.yaml
        ---
        # Build plan
        version: 2
        plan:
          project-key: BAM
          name: Bamboo Specs
          key: SPECS
        
        branches:
          create: for-new-branch
        
        stages:
          - Default Stage:
              jobs: 
                - Build
        Build:
          tasks:
            - script:
                - echo hello > test.txt
        
        ---
        version: 2
        deployment:
          name: deployment
          source-plan: BAM-SPECS
         
        release-naming: release-1
         
        environments:
          - Production
         
        Production:
          triggers:
            - build-success
          tasks:
            - clean
            - artifact-download
            - script:
                - echo hello
        
      1. Push the changes to Bitbucket Server.
      2. Bamboo will automatically create a new branch plan in BAM-SPECS. The deployment project will now be incorrectly linked to your plan branch and will start displaying the following warning message in the UI:
        • Despite the warning message the artifact definition does exit under the main plan branch of the source build plan. It is not removed. The problem now is that the deployment project is looking at the newly created divergent plan branch that has no artifact definition.
      3. Trigger a new build in BAMBOO-SPECS for the main plan branch (not the newly created divergent plan branch).
      4. The build will succeed and publish the artifact, which will automatically trigger the deployment release...

      Expected Results

      Deployment release successfully downloads the artifact that was just produced by the recently triggered build on BAMBOO-SPECS.

      Actual Results

      Deployment release fails to download the artifact because it's now looking for it under the new divergent plan branch instead of the main plan branch that literally just produced it.

      The below exception is thrown in the build logs:

      simple	08-Sep-2020 12:57:45	Starting task 'Download release contents' of type 'com.atlassian.bamboo.plugins.bamboo-artifact-downloader-plugin:artifactdownloadertask'
      simple	08-Sep-2020 12:57:45	Preparing to download plan result BAM-SPECS-6 artifact: Non required shared artifact: [test.txt], pattern: [test.txt]
      error	08-Sep-2020 12:57:45	Unable to download artifact Non required shared artifact: [test.txt], pattern: [test.txt]
      

      Re-running a failed deployment won't fix the problem because the release is now linked to and trying to download the artifact from the wrong branch.

      Workaround

      1. Re-scan the repository for Specs code inside Bamboo.
        • This will temporarily switch the deployment project link back to the main plan branch and will force the deployment project to start looking for artifacts produced by the main branch.
      2. Clone the deployment project.
        • The clone basically creates a new deployment project in the database while carrying some of the data over from the other deployment project. The deployment project will point to the main plan branch in the source build plan to look for artifacts after the clone operation.

      Those are temporary workarounds. The deployment project might start looking for artifacts in the wrong place again if a new divergent plan branch is created.

      Solution

      Upgrade Bamboo to version 7.1.1 or higher.

      Attachments

        Issue Links

          Activity

            People

              mgardias Marcin Gardias
              brosa Bruno Rosa
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: