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

Upgraded 1.1.1 of Pipeline Model Definition plugin throws error parsing concatenated variable-name/value strings

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Labels:
      None
    • Environment:
      Jenkins: 2.32.3
      Pipeline: Declarative Agent API - 1.1.1
      Pipeline: Declarative Extension Points API - 1.1.1
      Pipeline: Model Definition - 1.1.1
      Pipeline Model API - 1.1.1
      Pipeline: Stage Tags Metadata - 1.1.1
    • Similar Issues:

      Description

      Steps to Reproduce:

      1. Given https://github.com/mozilla/fxapom/blob/0f3b3cdb161940614ef50f2203a4633df1464c74/Jenkinsfile#L19
      2. Run a job with the above Jenkinsfile

      Actual Results:

      We get:

       

      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      WorkflowScript: 19: Environment variable values must either be strings or function calls. @ line 19, column 5.
      PYTEST_ADDOPTS =
      ^
       
      1 error
       
      at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
      at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1073)
      at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:591)
      at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:569)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:546)
      at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
      at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
      at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
      at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:67)
      at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:430)
      at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:393)
      at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:238)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:404)

      Finished: FAILURE

      Full console output here: https://gist.github.com/stephendonner/3b31a61c9456517888089ab025c63046

        Attachments

          Issue Links

            Activity

            Hide
            stephendonner Stephen Donner added a comment -

            Sorry; I should've noted that we were fine with this syntax using version 1.0.2 of https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Model+Definition+Plugin

            Show
            stephendonner Stephen Donner added a comment - Sorry; I should've noted that we were fine with this syntax using version 1.0.2 of https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Model+Definition+Plugin
            Hide
            abayer Andrew Bayer added a comment -

            Well, huh. The new parsing doesn't like the multiline statement, apparently. In the immediate, can you move that all onto one line, while I try to figure out whether we can actually support this syntax going forward?

            Show
            abayer Andrew Bayer added a comment - Well, huh. The new parsing doesn't like the multiline statement, apparently. In the immediate, can you move that all onto one line, while I try to figure out whether we can actually support this syntax going forward?
            Hide
            abayer Andrew Bayer added a comment -

            PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/139 - aiming at this going into a 1.1.2 that'll come out probably beginning of next week (once I'm fairly confident we won't get bit by more regression bugs coming in).

            Show
            abayer Andrew Bayer added a comment - PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/139  - aiming at this going into a 1.1.2 that'll come out probably beginning of next week (once I'm fairly confident we won't get bit by more regression bugs coming in).
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Andrew Bayer
            Path:
            pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy
            pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/Messages.properties
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/EnvironmentTest.java
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java
            pipeline-model-definition/src/test/resources/errors/invalidMultiExpressionEnvironment.groovy
            pipeline-model-definition/src/test/resources/multiExpressionEnvironment.groovy
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/577eb300baf578cd5d583bf02891acf862b3b308
            Log:
            [FIXED JENKINS-42771] Allow + binary expressions in env values

            This worked previously because we didn't actually pay attention to
            what was really in the value for an environment variable in the AST
            model, only at runtime. And the runtime parsing worked differently, so
            it did fine with `FOO = "A" + "B" + "C"`. Well, now so does the AST
            model. Yay!

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Andrew Bayer Path: pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/ModelParser.groovy pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/Messages.properties pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/EnvironmentTest.java pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/ValidatorTest.java pipeline-model-definition/src/test/resources/errors/invalidMultiExpressionEnvironment.groovy pipeline-model-definition/src/test/resources/multiExpressionEnvironment.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/577eb300baf578cd5d583bf02891acf862b3b308 Log: [FIXED JENKINS-42771] Allow + binary expressions in env values This worked previously because we didn't actually pay attention to what was really in the value for an environment variable in the AST model, only at runtime. And the runtime parsing worked differently, so it did fine with `FOO = "A" + "B" + "C"`. Well, now so does the AST model. Yay!

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                stephendonner Stephen Donner
              • Votes:
                2 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: