[JIRA] (JENKINS-57651) Trying to print a GString somehow causes pipeline code to be silently skipped

4 views
Skip to first unread message

trejkaz@trypticon.org (JIRA)

unread,
May 23, 2019, 11:42:01 PM5/23/19
to jenkinsc...@googlegroups.com
trejkaz created an issue
 
Jenkins / Improvement JENKINS-57651
Trying to print a GString somehow causes pipeline code to be silently skipped
Issue Type: Improvement Improvement
Assignee: Unassigned
Components: pipeline
Created: 2019-05-24 03:41
Priority: Major Major
Reporter: trejkaz

The following pipeline:

List<String> buildFlavours = ['ubuntu', 'macosx']
List<MyBuildStep> modulesGroups = [
  new MyBuildStep('UnitTestGroup1'),
  new MyBuildStep('UnitTestGroup2')
]

println "*** outside loop, buildFlavours.size() = ${buildFlavours.size()}"
buildFlavours.each { flavour ->
  println "*** inside loop, flavour = ${flavour}"
  println "*** outside loop, modulesGroups.size() = ${modulesGroups.size()}"
  modulesGroups.each { group ->

        // Doesn't work, silently terminates the iteration of the loop with no error either!
        println "*** inside loop, group = ${group}"

        // Somehow this works:
        // String groupCopy = group.toString()
        // println "*** inside loop, group = ${groupCopy}"
    }
}

class MyBuildStep implements Serializable {
    private String displayName

    MyBuildStep(String displayName) {
        this.displayName = displayName
    }

    @Override
    String toString() {
        return displayName
    }
}

Prints the following output:

[Pipeline] echo
*** outside loop, buildFlavours.size() = 2
[Pipeline] echo
*** inside loop, flavour = ubuntu
[Pipeline] echo
*** outside loop, modulesGroups.size() = 2
[Pipeline] echo
*** inside loop, flavour = macosx
[Pipeline] echo
*** outside loop, modulesGroups.size() = 2
[Pipeline] End of Pipeline

I expected to see the output for "*** inside loop, group = ${group}" as well, but it doesn't, and I don't get an error either, so I have no idea what's broken.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

trejkaz@trypticon.org (JIRA)

unread,
May 24, 2019, 12:31:01 AM5/24/19
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages