Pipeline - How to combine wrappers in Pipeline jobs?

Article ID:230922448
1 minute readKnowledge base

Issue

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

Resolution

You can nest them, for example:

node { wrap([$class: 'BuildUser']) { // https://plugins.jenkins.io/build-user-vars-plugin/ wrap([$class: 'TimestamperBuildWrapper']) { // https://plugins.jenkins.io/timestamper/ sh 'echo ${BUILD_USER}' // both wrappers applied here } } }
This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.