Reputation:
In a declarative pipeline parallel block, it is possible to specify 2nd stage to start with a lag of 2 hours after the first one has started?
Let's say I have 2 stages as below:
parallel {
stage('A') {
steps {
script {
sh do something
}
}
}
stage('B') {
steps {
script {
sh do something
}
}
}
}
When the job is kicked off, stage A starts. 2 hours later, Stage B would start. Is this possible?
Upvotes: 1
Views: 661
Reputation: 1401
You can use "sleep" within a stage to pause its execution.
stage("B") {
steps {
echo "Pausing stage B"
sleep(time: 2, unit: "HOURS")
}
}
Upvotes: 3