I'm trying to configure something that its harder than I thought.
There is a possibility that I can lose an agent in the middle of the
pipeline (this is not a problem, is expected due my k8s configuration, its
not ofen but can happen) so I would like to re-run the pipeline when this
happens.
Due is a pipeline Naginator and Periodic Reincarnation plugin will not
work, they work with freestyle projects, not with pipelines.
So, what thought was add a post step that will re-run the pipeline if
notices that the problem was agent's disconnetion.
I've noticed that, when I kill the agent, the pipeline aborts so this works:
#!/usr/bin/env groovy
pipeline {
agent {
label 'agent1'
}
stages {
stage('Verify template') {
steps {
container('container1') {
script{
sh 'uname -a'
sh 'sleep 600'
sh 'date'
}
}
}
}
}
post {
aborted {
build job: "$env.JOB_NAME", wait: false
}
}
}
Looks ok, works as expected but also is re-running the pipeline if I abort
the pipeline manually (which is expected too).
Other think I noticed is that always is showing Agent was removed in the
pipeline's output log, so if I can analyze the output, I would be able to
just re-run when I see that message and here is the problem, I don't find a
way to read the log from post.
Do you have some clue how to do it? There is a better way?
Thanks!
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/be400783-d8a1-4445-a1a8-7a80afc26c65o%40googlegroups.com.