Bamboo Specs scan fails with "Could not parse yaml input: Number of aliases for non-scalar nodes exceeds the specified max=1500"

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

Scanning a YAML Specs file in Bamboo fails with the following error: 

Bamboo YAML import failed: Invalid format of the YAML file: Number of aliases for non-scalar nodes exceeds the specified max=1500

Environment

All supported versions of Bamboo using YAML Specs.

Diagnosis

When scanning a YAML Repository-stored Specs in Bamboo, the following error is shown in the logs of the failed Specs execution:

02-Mar-2023 16:18:58	Bamboo YAML import failed: Invalid format of the YAML file: Number of aliases for non-scalar nodes exceeds the specified max=1500

The following stack trace can be found in the BAMBOO_HOME/logs/atlassian-bamboo.log file:

2023-03-02 16:18:58,466 INFO [15-BAM::SpecsDetection:pool-18-thread-4] [YamlSpecsImportServiceImpl] Bamboo YAML import failed on incorrect YAML
com.atlassian.bamboo.specs.yaml.YamlSpecsValidationException: Invalid format of the YAML file: Number of aliases for non-scalar nodes exceeds the specified max=1500
	at com.atlassian.bamboo.configuration.external.yaml.BambooYamlSpecsServiceImpl.splitDocuments(BambooYamlSpecsServiceImpl.java:54)
	at com.atlassian.bamboo.configuration.external.rss.YamlSpecsImportServiceImpl.processSimplifiedYaml(YamlSpecsImportServiceImpl.java:106)
	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.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	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.base/java.lang.Thread.run(Thread.java:829)
Caused by: org.yaml.snakeyaml.error.YAMLException: Number of aliases for non-scalar nodes exceeds the specified max=1500
[...]

Cause

When using Specs, Bamboo has a default limit of 1500 aliases for non-scalar nodes in a YAML file. For versions older than 7.0.6, 7.2.0, and 7.1.3, the limit was 50, as described in the following bug:

Solution

Bamboo versions 7.0.6, 7.1.3, 7.2.0 or newer

For these newer versions, a system property has been introduced to allow increasing the maximum number of aliases that can be read from a YAML Specs file. Please follow the steps below:

If you run Bamboo as a Windows Service, the steps to configure the property are different. Please refer to Configuring your system properties | Windows service for details on how to add the property below to your Bamboo instance.

  1. Backup and edit the BAMBOO_INSTALL/bin/setenv file.
  2. Add the following property to the JVM_SUPPORT_RECOMMENDED_ARGS line int the setenv file, replacing NEW_LIMIT with a value higher than 1500 that meets your YAML Specs file needs:

    -Dbamboo.specs.max.aliases.for.collections=NEW_LIMIT
  3. For example: 

    setenv.sh
    #  Occasionally Atlassian Support may recommend that you set some specific JVM arguments.  You can use this variable below to do that.
    #
    : ${JVM_SUPPORT_RECOMMENDED_ARGS:="-Dbamboo.setup.remote.agent.authentication.enabled=false"}
    JVM_SUPPORT_RECOMMENDED_ARGS="-Dbamboo.specs.max.aliases.for.collections=2000"
    
    #
    #  Uncomment the line below to enable the Byteman agent.
  4. Restart Bamboo so the changes are reflected.
  5. You can double-check if the property has been picked up by Bambo by going to Bamboo Administration > Overview > System information and looking for it in the Environment variables section:
  6. Run your Specs again and it should now succeed (as long as you've set a new value that covers the number of anchor aliases you are using). 

Bamboo versions older than 7.0.6, 7.1.3, 7.2.0

If you're running an older version of Bamboo (< 7.0.6, 7.2.0, 7.1.3), please upgrade to a more recent version to benefit from the aliases limit increase (now 1500) and for the possibility to increase that value (as described above).

Last modified on Mar 2, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.