Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-68830

readYaml fails with org.yaml.snakeyaml.error.YAMLException: Number of aliases for non-scalar nodes exceeds the specified max=50

    XMLWordPrintable

Details

    Description

      When trying to use the function `readYaml` on a yaml file with some aliases the following error pops up.{}

      09:58:40 org.yaml.snakeyaml.error.YAMLException: Number of aliases for non-scalar nodes exceeds the specified max=50*09:58:40* at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:172)09:58:40 at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:314)09:58:40 at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:305)09:58:40 at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:286)09:58:40 at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:188)09:58:40 at org.yaml.snakeyaml.composer.Composer.composeSequenceNode(Composer.java:245)09:58:40 at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:186)09:58:40 at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:314)09:58:40 at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:305)09:58:40 at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:286)09:58:40 at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:188)09:58:40 at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:314)09:58:40 at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:305)09:58:40 at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:286)09:58:40 at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:188)09:58:40 at org.yaml.snakeyaml.composer.Composer.composeValueNode(Composer.java:314)09:58:40 at org.yaml.snakeyaml.composer.Composer.composeMappingChildren(Composer.java:305)09:58:40 at org.yaml.snakeyaml.composer.Composer.composeMappingNode(Composer.java:286)09:58:40 at org.yaml.snakeyaml.composer.Composer.composeNode(Composer.java:188)09:58:40 at org.yaml.snakeyaml.composer.Composer.getNode(Composer.java:115)09:58:40 at org.yaml.snakeyaml.constructor.BaseConstructor.getData(BaseConstructor.java:135)09:58:40 at org.yaml.snakeyaml.Yaml$1.next(Yaml.java:514)09:58:40 at org.jenkinsci.plugins.pipeline.utility.steps.conf.ReadYamlStep$Execution.doRun(ReadYamlStep.java:126)09:58:40 at org.jenkinsci.plugins.pipeline.utility.steps.AbstractFileOrTextStepExecution.run(AbstractFileOrTextStepExecution.java:29)09:58:40 at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)09:58:40 at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)09:58:40 at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)09:58:40 at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)09:58:40 at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)09:58:40 at java.base/java.lang.Thread.run(Thread.java:829)

      Attachments

        Issue Links

          Activity

            danielbeck Daniel Beck added a comment -

            load many jobs vi jcasc/yaml

            Unrelated to this issue, which is about https://plugins.jenkins.io/pipeline-utility-steps/

            danielbeck Daniel Beck added a comment - load many jobs vi jcasc/yaml Unrelated to this issue, which is about https://plugins.jenkins.io/pipeline-utility-steps/
            jzielke jzielke added a comment -

            danielbeck So where do I put this issue?

            jzielke jzielke added a comment - danielbeck So where do I put this issue?

            Thanks for your recent changes Now it looks after https://github.com/jenkinsci/pipeline-utility-steps-plugin/pull/152/files released in 2.15.0 it's possible to set:

            System.setProperty("org.jenkinsci.plugins.pipeline.utility.steps.conf.ReadYamlStep.MAX_MAX_ALIASES_FOR_COLLECTIONS", "500") 

            and then use the readYaml step with the parameter maxAliasesForCollections for example:

            readYaml file: 'some.yaml', maxAliasesForCollections: 500
            

            But do you have any idea why setting this property doesn't work when applied on a running instance? When I'll add exactly the same property (copy/paste) to init.groovy and I'll restart the instance then it works. Of course System.getProperty returns the appropriate value but the step keeps returns:

            java.lang.IllegalArgumentException: 500 > 50. Reduce the aliases in your yaml or convince your administrator to increase the max allowed value with the system property "org.jenkinsci.plugins.pipeline.utility.steps.conf.ReadYamlStep.MAX_MAX_ALIASES_FOR_COLLECTIONS" 
            mjanczuk Mateusz Janczuk added a comment - Thanks for your recent changes Now it looks after https://github.com/jenkinsci/pipeline-utility-steps-plugin/pull/152/files released in 2.15.0 it's possible to set: System .setProperty( "org.jenkinsci.plugins.pipeline.utility.steps.conf.ReadYamlStep.MAX_MAX_ALIASES_FOR_COLLECTIONS" , "500" ) and then use the readYaml step with the parameter maxAliasesForCollections for example: readYaml file: 'some.yaml' , maxAliasesForCollections: 500 But do you have any idea why setting this property doesn't work when applied on a running instance? When I'll add exactly the same property (copy/paste) to init.groovy and I'll restart the instance then it works. Of course System.getProperty returns the appropriate value but the step keeps returns: java.lang.IllegalArgumentException: 500 > 50. Reduce the aliases in your yaml or convince your administrator to increase the max allowed value with the system property "org.jenkinsci.plugins.pipeline.utility.steps.conf.ReadYamlStep.MAX_MAX_ALIASES_FOR_COLLECTIONS"
            danielbeck Daniel Beck added a comment - - edited

            doesn't work when applied on a running instance

            A lot of system property overrides in Jenkins behave that way, as they're evaluated only at startup (some also during runtime, but it's not the standard). Thus setting the value as a command line argument is the only (fairly) consistently supported way to set them and documented at https://www.jenkins.io/doc/book/managing/system-properties/

            In this case, you can set the property initialized from the system property directly using the following Script Console script:

            org.jenkinsci.plugins.pipeline.utility.steps.conf.ReadYamlStep.MAX_MAX_ALIASES_FOR_COLLECTIONS = 500
            danielbeck Daniel Beck added a comment - - edited doesn't work when applied on a running instance A lot of system property overrides in Jenkins behave that way, as they're evaluated only at startup (some also during runtime, but it's not the standard). Thus setting the value as a command line argument is the only (fairly) consistently supported way to set them and documented at https://www.jenkins.io/doc/book/managing/system-properties/ In this case, you can set the property initialized from the system property directly using the following Script Console script: org.jenkinsci.plugins.pipeline.utility.steps.conf.ReadYamlStep.MAX_MAX_ALIASES_FOR_COLLECTIONS = 500

            danielbeck thanks! I never tried this way, always with System.setProperty Now it works (as I checked on one of our instances for which it is tough to find an appropriate time to restart)

            mjanczuk Mateusz Janczuk added a comment - danielbeck thanks! I never tried this way, always with System.setProperty Now it works (as I checked on one of our instances for which it is tough to find an appropriate time to restart)

            People

              rsandell rsandell
              reakaleek Jan Calanog
              Votes:
              5 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated: