Task of downloading an artifact in bamboo-specs gives non-informative error

mgvali
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 17, 2023

I'm using Bamboo 8.2.

According to specs manual at https://docs.atlassian.com/bamboo-specs-docs/8.2.0/specs.html?yaml#using-a-shared-artifact-in-another-plan

I'd be able to build an artifact from PROJECTA_PLANA and use it from PROJECTB_PLANB.

Given the publish part shows artifacts actually in Bamboo web ui according to specs -- ie. the scripts artifact is present after build:

version: 2
plan:
  project-key: PROJECTA
  key: PLANA
..
Build:
  artifacts:
   - name: scripts
    required: true
    pattern: '*.sh'
    shared: true

Trying to download fails with "Bamboo YAML import failed: Document structure is incorrect: Sandbox / tasks / [0]: Unknown task type artifact-download"

version: 2
deployment:
source-plan: PROJECTB_PLANB
..
Sandbox:
tasks:

- artifact-download:
source-plan: PROJECTA_PLANA

 I've also tried variations according to manual in vain, for example:

version: 2
deployment:
  source-plan: PROJECTB_PLANB
..

Sandbox:
  tasks:
    - artifact-download:
      source-plan: PROJECTA_PLANA
      artifacts:
        - destination: ./scripts
         name: scripts

How would I debug this issue further, please?

1 answer

1 vote
alok m
Contributor
April 14, 2024

It seems like you are encountering issues with the use of the artifact-download task in your Bamboo YAML configuration. The error message, "Bamboo YAML import failed: Document structure is incorrect," typically indicates a syntax or formatting error, or a misunderstanding of how the task should be defined according to Bamboo's specifications. Here’s a step-by-step approach to debug and potentially resolve the issue:

  1. Validate YAML Syntax

First, ensure that your YAML syntax is correct. YAML is very sensitive to indentation and formatting. Use a YAML validator tool to check for syntax errors, like improper indentation or misplaced characters.

  1. Check Documentation for Version Differences

Since you are using Bamboo 8.2, make sure that the syntax you are using matches exactly with what's specified for version 8.2 in the Bamboo documentation. Sometimes, documentation may have examples that are slightly out of date or apply to only specific versions.

  1. Correct YAML Configuration for Artifact Download

The configuration for downloading artifacts can be tricky. Here’s a correct structure for defining an artifact download task in a deployment project according to the Bamboo YAML specs:

yamlCopy code

version: 2 deployment: project-key: PROJECTB key: PLANB environment: Production tasks: - artifact-download: source-plan: PROJECTA-PLANA artifacts: - name: scripts destination: scripts

Ensure that:

  • The source-plan field correctly references the plan key from which the artifact is shared.
  • The artifact's name and destination are specified correctly.
  1. Verify Configuration in Bamboo UI

Use the Bamboo UI to manually set up an artifact download task to ensure that you understand the required fields and options. Once you have a working configuration in the UI, try to replicate that configuration in your YAML file.

  1. Use Log Output for Additional Clues

When you import your YAML configuration and it fails, Bamboo typically provides log output that can give additional clues about what exactly is wrong. Look for specific messages about unrecognized fields or incorrect values.

  1. Ensure Correct Plan Keys and Project Structure

Make sure that the source-plan key matches exactly what Bamboo expects. This usually includes both the project key and the plan key (e.g., PROJECTA-PLANA). Incorrect references will lead to errors during YAML parsing.

 

  1. Test Incrementally

When dealing with complex configurations, build your YAML incrementally. Start by configuring a very simple task or stage and ensure that imports correctly. Then, gradually add more complexity. This can help isolate the specific part of the YAML that causes the issue.

By following these steps, you should be able to pinpoint the source of your configuration problems and get your Bamboo YAML files working as expected.

 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events