Pipeline - How to combine wrappers in Pipeline jobs?

Issue

How do I combine two wrappers together in a Pipeline job?

Environment

Resolution

You can nest them, for example:

node {
    wrap([$class: 'BuildUser']) { // https://wiki.jenkins-ci.org/display/JENKINS/Build+User+Vars+Plugin
        wrap([$class: 'TimestamperBuildWrapper']) { // https://wiki.jenkins-ci.org/display/JENKINS/Timestamper
            sh 'echo ${BUILD_USER}' // both wrappers applied here
        }
    }
}

References

Have more questions?

0 Comments

Please sign in to leave a comment.