| When the Pod retention policy is set on "onFailure" and the build fails, the slaves should be kept for debug and analysis. However, they are terminated immediately as if the build was succesful. For instance, we can use this simple Pod template.
podTemplate(podRetention: onFailure(),
activeDeadlineSeconds: 600,
yaml: """
apiVersion: v1
kind: Pod
spec:
containers:
- name: ansible
image: (private repo)/ansible:0.2
imagePullPolicy: IfNotPresent
command: ['cat']
tty: true
"""
)
I have also used a simple pipeline
{
node(POD_LABEL) {
container('ansible') {
sh "sleep 10"
sh "hola"
}
}
}
As a result the pod will fail, since the if not such command as "hola". Due to the Pod retention policy, I would expect that the pod is still alive for the timeout configured, but Jenkins terminates it. To reproduce this issue is as simple as deploy the stable/jenkins Helm chart and create a pipeline with the details given above. |