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

String constants containing characters than need escaping are not round-tripped correctly

    XMLWordPrintable

Details

    Description

      The following script cannot be round-tripped

      pipeline {
          agent none
          stages {
              stage("foo") {
                  echo '''Hello!
      'How are you?', said script A
      
      "I am fine \'\'\'really\'\'\'" said script B
      
      '''
                  sh 'echo "\'quoted\'"'
              }
          }
      }
      

      Attachments

        Issue Links

          Activity

            bitwiseman Liam Newman added a comment -

            Bulk closing resolved issues.

            bitwiseman Liam Newman added a comment - Bulk closing resolved issues.

            Code changed in jenkins
            User: Stephen Connolly
            Path:
            src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTPipelineDef.groovy
            src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTValue.groovy
            src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java
            src/test/resources/json/stringsNeedingEscapeLogic.json
            src/test/resources/stringsNeedingEscapeLogic.groovy
            http://jenkins-ci.org/commit/pipeline-model-definition-plugin/506647b2725051adf55a95a9bd0893bde117250f
            Log:
            [FIXED JENKINS-38818] Correctly escape string constants when generating groovy from AST

            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Stephen Connolly Path: src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTPipelineDef.groovy src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/ast/ModelASTValue.groovy src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/AbstractModelDefTest.java src/test/resources/json/stringsNeedingEscapeLogic.json src/test/resources/stringsNeedingEscapeLogic.groovy http://jenkins-ci.org/commit/pipeline-model-definition-plugin/506647b2725051adf55a95a9bd0893bde117250f Log: [FIXED JENKINS-38818] Correctly escape string constants when generating groovy from AST

            May also want to handle round-tripping {{GString}}s but I'm too lazy to look up the escaping rules for those!

            stephenconnolly Stephen Connolly added a comment - May also want to handle round-tripping {{GString}}s but I'm too lazy to look up the escaping rules for those!

            People

              abayer Andrew Bayer
              stephenconnolly Stephen Connolly
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: