Bamboo YAML Specs fails to import and process the plan branch as specs with an artifact download task and SCP task that make use of the artifact of the plan branch.

XMLWordPrintable

    • 1
    • Severity 2 - Major

      Issue Summary

      • Bamboo YAML Specs fails to import specs code and process the plan branch as a specs branch with an artifact download task and SCP task that make use of the artifact downloaded(from artifact download task) of that plan branch.

      This is reproducible on Data Center:

      Steps to Reproduce

      1. Create a plan(by importing YAML specs code) with artifact creation and 2 tasks mentioned below:
        1. Artifact download task - downloads the artifact created through this plan.
        2. SCP Task: This uses the artifact from the above artifact download task.
          Below is the sample specs code:
          Default Job:
            key: JOB1
            tasks:
            - checkout:
                force-clean-build: 'false'
            - script:
                interpreter: SHELL
                scripts:
                - echo "hello" >hello.txt
                description: hello
            artifacts:
            - name: arts
              pattern: '*.txt'
              shared: true
              required: true
            artifact-subscriptions: []
          deploy:
            key: DEP
            tasks:
            - artifact-download:
                artifacts:
                - name: arts
                description: art down
            - scp:
                host: '111'
                artifact:
                  name: arts
                  source-plan: TP-PLAN
                destination-path: /test
                authentication:
                  username: admin
                  password: admin
            artifact-subscriptions: []
          

          Please refer to this page for more details on how to create plan through Bamboo YAML specs: Tutorial: Bamboo Specs YAML stored in Bitbucket Server

      2. Create a branch in the Bitbucket repository server(where above yaml specs code is stored) which creates a plan branch in Bamboo for this plan.

      Expected Results

      Plan branch specs code should be processed and converted into a specs branch without any issue.

      Actual Results

      • Plan branch specs code import fails with error Artifact with name: 'arts' is not defined in a job or an environment. and it remains in the state "AWAITING SPECS EXECUTION" as shown below.

        The below exception is thrown in the atlassian-bamboo.log file:
        2023-01-18 12:26:04,045 INFO [15-BAM::SpecsDetection:pool-19-thread-4] [YamlSpecsImportServiceImpl] Bamboo YAML import failed
        java.lang.IllegalStateException: Artifact with name: 'arts' is not defined in a job or an environment.
        	at com.atlassian.bamboo.plugins.scp.exporter.ScpTaskExporter.toTaskConfiguration(ScpTaskExporter.java:134) ~[?:?]
        	at com.atlassian.bamboo.task.export.TaskDefinitionExporter.toTaskConfiguration(TaskDefinitionExporter.java:67) ~[atlassian-bamboo-api-9.0.1.jar:?]
        	at com.atlassian.bamboo.configuration.external.helpers.TaskDefinitionExportHelper.importTaskDefinition(TaskDefinitionExportHelper.java:144) ~[atlassian-bamboo-import-export-9.0.1.jar:?]
        	at com.atlassian.bamboo.configuration.external.PlanConfigImportServiceImpl.importTaskProperties(PlanConfigImportServiceImpl.java:1501) ~[atlassian-bamboo-import-export-9.0.1.jar:?]
        	at com.atlassian.bamboo.configuration.external.PlanConfigImportServiceImpl.lambda$createTasks$29(PlanConfigImportServiceImpl.java:1481) ~[atlassian-bamboo-import-export-9.0.1.jar:?]
        	at java.util.ArrayList.forEach(ArrayList.java:1541) ~[?:?]
        	at com.atlassian.bamboo.configuration.external.PlanConfigImportServiceImpl.createTasks(PlanConfigImportServiceImpl.java:1481) ~[atlassian-bamboo-import-export-9.0.1.jar:?]
        	at com.atlassian.bamboo.configuration.external.PlanConfigImportServiceImpl.lambda$modifyDivergentPlanBranchFunction$11(PlanConfigImportServiceImpl.java:934) ~[atlassian-bamboo-import-export-9.0.1.jar:?]
        	at com.atlassian.bamboo.core.ScopedExclusionServiceImpl.tryWithLock(ScopedExclusionServiceImpl.java:74) ~[atlassian-bamboo-core-9.0.1.jar:?]
        	at com.atlassian.bamboo.configuration.external.PlanConfigImportServiceImpl.modifyExistingPlanBranch(PlanConfigImportServiceImpl.java:691) ~[atlassian-bamboo-import-export-9.0.1.jar:?]
        

        Same error can be seen in Specs execution build log.

      Workaround

      Update source plan details in the artifact download task and SCP task to the plan key of the plan branch in the SPECS source code of the branch in the Bitbucket repository. Below is the example:

      deploy:
        key: DEP
        tasks:
        - artifact-download:
            source-plan: TP-PLAN1
            artifacts:
            - name: arts
            description: art down
        - scp:
            host: '111'
            artifact:
              name: arts
              source-plan: TP-PLAN1
            destination-path: /test
            authentication:
              username: admin
              password: admin
        artifact-subscriptions: []
      

      This will fix the issue and successfully import the specs code for the plan branch and convert it into a specs branch as shown below.

        1. specs_branch.png
          specs_branch.png
          452 kB
        2. Specs_branch_import_failed.png
          Specs_branch_import_failed.png
          383 kB

              Assignee:
              Wioletta Dys
              Reporter:
              Jyothi Charupalli
              Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: