Pipeline 2.0: How to apply multiple wrappers?

44 views
Skip to first unread message

thok...@gmail.com

unread,
Dec 14, 2016, 10:09:08 AM12/14/16
to Jenkins Users
I would like to do this:


stage
{
    timestamps
{
        ansiColor
('xterm') {
            sh
'echo "Hello World"'
       
}

   
}
}

Or, using alternative syntax:


stage
{
   
wrap([$class: 'TimestamperBuildWrapper']) {
        wrap([$class: 'AnsiColorBuildWrapper', colorMapName: 'xterm']) {
            sh 'echo "Hello World"'
       
}

   
}
}


Unfortunately, the second wrapper just gets ignored, so in the above case, I see only timestamps, but no color.

Using the Job-DSL, this was extremely straightforward:

wrappers {
    timestamps
()
    colorizeOutput
()
}

How to solve this problem?

thok...@gmail.com

unread,
Dec 14, 2016, 10:19:24 AM12/14/16
to Jenkins Users
Nevermind it actually does work this way.
Reply all
Reply to author
Forward
0 new messages