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

Pipeline plugin groovy interpreter does not interpret splitEachLine() for all lines

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Duplicate
    • Component/s: pipeline
    • Environment:
      Unix + Windows, Jenkins 2.8
    • Similar Issues:

      Description

      Enter the following pipe

      stage "NOK"
          "A.AA\nB.BB\n".splitEachLine(/\./) {
              line -> println "${line[0]} -> ${line[1]}"
          }
      
      stage "OK"
          "A.AA\nB.BB\n".split(/\n/).each {
              line = it.split(/\./)
              println "${line[0]} -> ${line[1]}"
          }
      

      and disable the sandbox. When you run the pipeline you will see

      [Pipeline] stage (NOK)
      Entering stage NOK
      Proceeding
      [Pipeline] echo
      A -> AA
      [Pipeline] stage (OK)
      Entering stage OK
      Proceeding
      [Pipeline] echo
      A -> AA
      [Pipeline] echo
      B -> BB
      [Pipeline] End of Pipeline
      Finished: SUCCESS
      

      You see that the splitEachLine() is only processing the first line (NOK-stage). I would expect the same result as in the OK-stage.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                andreasschrell Andreas Schrell
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: