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

Regression: Escaped double quotes in "environment" blocks are over-resolved

    Details

    • Similar Issues:

      Description

      Discussed with abayer on #jenkins, he asked me to make a JIRA ticket for this.

      I upgraded from pipeline model definition ~1.0 to 1.1.2, and my pipelines broke.

      Specifically, the following escaped double quoting does not work any more: https://github.com/WillowChat/Hopper/blob/6e13089d9b9a0b61030d1ee3a7d949d7ac14b8fe/Jenkinsfile#L23

      But the same line with single quotes does: https://github.com/WillowChat/Hopper/blob/90eb695051405fadc818cf365a1ed7571ce1f645/Jenkinsfile#L23

      The error log is available here, it looks like it's trying to resolve the branch name (which is `develop`), which results in a confusing Groovy binding error message: https://ci.carrot.codes/job/Willow%20Chat/job/Hopper/job/develop/6/console

      (And in case that log disappears for some reason)
      groovy.lang.MissingPropertyException: No such property: develop for class: groovy.lang.Binding
       

        Attachments

          Issue Links

            Activity

            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/Utils.groovy
            pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Environment.groovy
            pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy
            pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/when/impl/EnvironmentConditionalScript.groovy
            pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/EnvironmentTest.java
            pipeline-model-definition/src/test/resources/envQuotesInQuotes.groovy
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/efc64bee6b98a5e1693a990b3203fc0a727bdb1b
            Log:
            [FIXED JENKINS-43404] Escape/unescape strings being evaluated

            Not doing this resulted in unescaped double quotes and therefore
            errors, so let's make sure we always escape strings when they're
            passed in to be evaluated and unescape them after the evaluation.

            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/Utils.groovy pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/model/Environment.groovy pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy pipeline-model-definition/src/main/resources/org/jenkinsci/plugins/pipeline/modeldefinition/when/impl/EnvironmentConditionalScript.groovy pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/EnvironmentTest.java pipeline-model-definition/src/test/resources/envQuotesInQuotes.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/efc64bee6b98a5e1693a990b3203fc0a727bdb1b Log: [FIXED JENKINS-43404] Escape/unescape strings being evaluated Not doing this resulted in unescaped double quotes and therefore errors, so let's make sure we always escape strings when they're passed in to be evaluated and unescape them after the evaluation.
            Hide
            abayer Andrew Bayer added a comment -

            PR up at https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/150 - hopefully this doesn't cause other regressions. =)

            Show
            abayer Andrew Bayer added a comment - PR up at  https://github.com/jenkinsci/pipeline-model-definition-plugin/pull/150  - hopefully this doesn't cause other regressions. =)

              People

              • Assignee:
                abayer Andrew Bayer
                Reporter:
                carrotcodes Sky Welch
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: