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

If a plan has no permissions set and is exported as YAML Specs, the yaml file will be invalid

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Low Low
    • 9.0.0
    • 8.2.3
    • Bamboo Specs
    • None

      Issue Summary

      If a plan has no permissions set and is exported as YAML Specs, the yaml file will be invalid

      Steps to Reproduce

      1. Create a plan and remove all default permissions.
      2. Export the plan as YAML Specs.
      3. Try to import the plan as YAML.

      Expected Results

      Plan is published successfully.

      Actual Results

      Spes execution fails.

      The yaml file will express the empty permissions in the following way:

      ---
      version: 2
      plan:
        key: PR-PL1
      plan-permissions: []
      ...
      

      which will result in the following error:

      2022-06-22 17:10:18,442 INFO [15-BAM::SpecsDetection:pool-18-thread-4] [YamlSpecsImportServiceImpl] Bamboo YAML import failed on incorrect YAML
      com.atlassian.bamboo.specs.yaml.YamlSpecsValidationException: Document structure is incorrect: plan-permissions: List must not be empty.
         at com.atlassian.bamboo.configuration.external.yaml.BambooYamlParserImpl.parsePlanPermissions(BambooYamlParserImpl.java:493)
         at com.atlassian.bamboo.configuration.external.rss.YamlSpecsImportServiceImpl.parseYaml(YamlSpecsImportServiceImpl.java:181)
         at com.atlassian.bamboo.configuration.external.rss.YamlSpecsImportServiceImpl.processSimplifiedYaml(YamlSpecsImportServiceImpl.java:107)
         at com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl.tryProcessYaml(RepositoryStoredSpecsServiceImpl.java:338)
         at com.atlassian.bamboo.configuration.external.RepositoryStoredSpecsServiceImpl.runBambooSpecs(RepositoryStoredSpecsServiceImpl.java:184)
         at com.atlassian.bamboo.configuration.external.RssDetectionServiceImpl.runRssDetection(RssDetectionServiceImpl.java:374)
         at com.atlassian.bamboo.configuration.external.detection.RssDetectionRunnable.run(RssDetectionRunnable.java:42)
         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
         at java.util.concurrent.FutureTask.run(FutureTask.java:266)
         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
         at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)
         at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
         at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
         at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
         at java.lang.Thread.run(Thread.java:748)
      Caused by: com.atlassian.bamboo.specs.api.exceptions.PropertiesValidationException: plan-permissions: List must not be empty.
         at com.atlassian.bamboo.specs.api.validators.common.ImporterUtils.checkThat(ImporterUtils.java:40)
         at com.atlassian.bamboo.specs.yaml.BambooYamlParserUtils.checkListNotEmpty(BambooYamlParserUtils.java:204)
         at com.atlassian.bamboo.specs.yaml.MapNode.getList(MapNode.java:70)
         at com.atlassian.bamboo.configuration.external.yaml.BambooYamlParserImpl.parsePlanPermissions(BambooYamlParserImpl.java:486)
         ... 15 more
      
      

      Workaround

      It's possible to bypass this problem in two ways:

      • Not including permissions in the yaml file. This can be achieved simply by deleting:
        ---
        version: 2
        plan:
          key: PR-PL1
        plan-permissions: []
        ...
        

        (this option will not update permissions, and will keep the current configuration)

      • Create one permission (for example, for an admin), and in this way the collection won't be empty.
        A default example could be:
        ---
        version: 2
        plan:
          key: PR-PL1
        plan-permissions:
        - users:
          - admin
          permissions:
          - view
          - edit
          - build
          - clone
          - admin
          - viewConfiguration
        ...
        

              851f15845f55 Mateusz Szmal
              pdemitrio Patricio (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: