Reputation: 1092
I want to run the post part of my declarative pipeline inside a docker container. And I don't know how to set the agent only for post.
Sample of my pipeline
post {
always {
echo 'This will always run'
}
success {
mail ## my mail content;
}
}
And I want to run this mail command in a docker container.
Upvotes: 7
Views: 5829
Reputation: 4203
You can use the node(...){...}
block within the post steps, with or without the script {...}
block as applicable:
post {
always {
echo 'This will always run'
}
success {
node('docker') {
script {
mail ## my mail content;
}
}
}
}
Upvotes: 8