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

YAML Spec scan fails if the include tag files contains permission definition

      Issue Summary

      YAML Specs extends YAML with the !include 'file' tag. The include tag expands to the content of the file where it is placed. If the YAML files contain permission, the Specs scan will fail.

      Steps to Reproduce

      1.  Define multiple YAML Spec files, which contains plan permission e.g. plan1.yml and plan2.yml
      2. Include the files in bamboo.yml file
        ---
        !include 'plan1.yml'
        ---
        !include 'plan2.yml'
        

      Expected Results

      Multiple plans should be created on Specs scan

      Actual Results

      Scan fails, with only one plan created, with error in log

       Invalid format of the YAML file: expected a single document in the stream
      

      Workaround

      Define each plan permission in the main bamboo.yml file, and not in each plan YAML file

      ---
      !include 'plan1.yml'
      ---
      !include 'plan2.yml'
      
      ---
      version: 2
      plan: PROJECT-PLAN1
      
      plan-permissions:
        - users: admin
          permissions:
            - admin
        - roles: logged-in
          permissions:
            - view
      
      ---
      version: 2
      plan: PROJECT-PLAN2
      
      plan-permissions:
        - users:
            - admin
          permissions:
            - view
          - roles: logged-in
          permissions:
            - view 

            [BAM-21510] YAML Spec scan fails if the include tag files contains permission definition

            Andrew Trapani added a comment - - edited

            NOTE: Reproduced on

            Continuous integration powered by Atlassian Bamboo version 9.2.1 build 90201 - 06 Feb 23

             

            The answer may also be, "Can you upgrade to bamboo version >= 9.6.11?"

            Andrew Trapani added a comment - - edited NOTE: Reproduced on Continuous integration powered by Atlassian Bamboo version 9.2.1 build 90201 - 06 Feb 23   The answer may also be, "Can you upgrade to bamboo version >= 9.6.11?"

            Can't reproduce at 9.6.11
            Created bamboo.yaml with content

            ---
            !include 'plan-test-yaml.yaml'
            ---
            !include 'plan-test-yaml2.yaml'
            ---
            !include 'test-yaml-permissions.yaml'
            ---
            !include 'test-yaml2-permissions.yaml'
            ...
            

            Created file plan-test-yaml.yaml

            version: 2
            plan:
              project-key: TEST
              key: YAML
              name: Yaml specs
            stages:
              - Default Stage:
                  manual: false
                  final: false
                  jobs:
                    - Default Job
            Default Job:
              key: JOB1
              other:
                all-other-apps:
                  custom.test.ephemeral.agent.enabled: 'false'
              tasks:
                - any-task:
                    plugin-key: com.atlassian.bamboo.plugin.dotnet:vstestRunner
                    configuration:
                      resultsfile: testresults.trx
                      useVsixExtensions: runnr
                      label: runnr
                      vstestInIsolation: 'true'
                      vstestTestFile: test
                      vstestResultDir: dir
              artifact-subscriptions: []
            repositories: []
            triggers: []
            branches:
              create: manually
              delete: never
              link-to-jira: true
            notifications: []
            labels: []
            dependencies:
              require-all-stages-passing: false
              enabled-for-branches: true
              block-strategy: none
              plans: []
            other:
              concurrent-build-plugin: system-default
            

            Created file plan-test-yaml2.yaml

            version: 2
            plan:
              project-key: TEST
              key: YAML2
              name: Yaml2 specs
            stages:
              - Default Stage:
                  manual: false
                  final: false
                  jobs:
                    - Default Job
            Default Job:
              key: JOB1
              other:
                all-other-apps:
                  custom.test.ephemeral.agent.enabled: 'false'
              tasks:
                - any-task:
                    plugin-key: com.atlassian.bamboo.plugin.dotnet:vstestRunner
                    configuration:
                      resultsfile: testresults.trx
                      useVsixExtensions: runnr
                      label: runnr
                      vstestInIsolation: 'true'
                      vstestTestFile: test
                      vstestResultDir: dir
              artifact-subscriptions: []
            repositories: []
            triggers: []
            branches:
              create: manually
              delete: never
              link-to-jira: true
            notifications: []
            labels: []
            dependencies:
              require-all-stages-passing: false
              enabled-for-branches: true
              block-strategy: none
              plans: []
            other:
              concurrent-build-plugin: system-default
            

            Created file test-yaml2-permissions.yaml

            version: 2
            plan:
              key: TEST-YAML2
            plan-permissions:
              - users:
                  - admin
                permissions:
                  - view
                  - edit
                  - build
                  - clone
                  - admin
                  - view-configuration
              - users:
                  - user
                permissions:
                  - view
                  - edit
                  - build
                  - clone
                  - view-configuration
              - roles:
                  - logged-in
                  - anonymous
                permissions:
                  - view
            

            Created file test-yaml-permissions.yaml

            version: 2
            plan:
              key: TEST-YAML
            plan-permissions:
              - users:
                  - admin
                permissions:
                  - view
                  - edit
                  - build
                  - clone
                  - admin
                  - view-configuration
              - users:
                  - user
                permissions:
                  - view
                  - edit
                  - build
                  - clone
                  - view-configuration
              - roles:
                  - logged-in
                  - anonymous
                permissions:
                  - view
            

            Pushed to Bitbucket Data Center. Plans created, permissions applied

            Alexey Chystoprudov added a comment - Can't reproduce at 9.6.11 Created bamboo.yaml with content --- !include 'plan-test-yaml.yaml' --- !include 'plan-test-yaml2.yaml' --- !include 'test-yaml-permissions.yaml' --- !include 'test-yaml2-permissions.yaml' ... Created file plan-test-yaml.yaml version: 2 plan: project-key: TEST key: YAML name: Yaml specs stages: - Default Stage: manual: false final : false jobs: - Default Job Default Job: key: JOB1 other: all-other-apps: custom.test.ephemeral.agent.enabled: ' false ' tasks: - any-task: plugin-key: com.atlassian.bamboo.plugin.dotnet:vstestRunner configuration: resultsfile: testresults.trx useVsixExtensions: runnr label: runnr vstestInIsolation: ' true ' vstestTestFile: test vstestResultDir: dir artifact-subscriptions: [] repositories: [] triggers: [] branches: create: manually delete: never link-to-jira: true notifications: [] labels: [] dependencies: require-all-stages-passing: false enabled- for -branches: true block-strategy: none plans: [] other: concurrent-build-plugin: system- default Created file plan-test-yaml2.yaml version: 2 plan: project-key: TEST key: YAML2 name: Yaml2 specs stages: - Default Stage: manual: false final : false jobs: - Default Job Default Job: key: JOB1 other: all-other-apps: custom.test.ephemeral.agent.enabled: ' false ' tasks: - any-task: plugin-key: com.atlassian.bamboo.plugin.dotnet:vstestRunner configuration: resultsfile: testresults.trx useVsixExtensions: runnr label: runnr vstestInIsolation: ' true ' vstestTestFile: test vstestResultDir: dir artifact-subscriptions: [] repositories: [] triggers: [] branches: create: manually delete: never link-to-jira: true notifications: [] labels: [] dependencies: require-all-stages-passing: false enabled- for -branches: true block-strategy: none plans: [] other: concurrent-build-plugin: system- default Created file test-yaml2-permissions.yaml version: 2 plan: key: TEST-YAML2 plan-permissions: - users: - admin permissions: - view - edit - build - clone - admin - view-configuration - users: - user permissions: - view - edit - build - clone - view-configuration - roles: - logged-in - anonymous permissions: - view Created file test-yaml-permissions.yaml version: 2 plan: key: TEST-YAML plan-permissions: - users: - admin permissions: - view - edit - build - clone - admin - view-configuration - users: - user permissions: - view - edit - build - clone - view-configuration - roles: - logged-in - anonymous permissions: - view Pushed to Bitbucket Data Center. Plans created, permissions applied

            Please update the documentation to either append the plan-permissions to the main bamboo.yml or to place the plan-permissions into a separate file and include it.

            PROBLEM: The error message does not help diagnose that the plan-permissions shouldn't be included in the same file, e.g. at the end of the above plan1.yml.

            Answered publicly after manual trial and error on my own:

            https://community.atlassian.com/t5/Bamboo-questions/YAML-spec-How-to-make-a-plan-permission-for-multiple-build-plan/qaq-p/2278200#M33627

            Andrew Trapani added a comment - Please update the documentation to either append the plan-permissions to the main bamboo.yml or to place the plan-permissions into a separate file and include it. PROBLEM: The error message does not help diagnose that the plan-permissions shouldn't be included in the same file, e.g. at the end of the above plan1.yml. Answered publicly after manual trial and error on my own: https://community.atlassian.com/t5/Bamboo-questions/YAML-spec-How-to-make-a-plan-permission-for-multiple-build-plan/qaq-p/2278200#M33627

              Unassigned Unassigned
              voseghale VICTOR-OSEGHALE (Inactive)
              Affected customers:
              4 This affects my team
              Watchers:
              9 Start watching this issue

                Created:
                Updated: