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

XMLWordPrintable

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

      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.

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

              Created:
              Updated:
              Resolved: