File tree 1 file changed +6
-3
lines changed
1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change 5
5
corev1 "k8s.io/api/core/v1"
6
6
)
7
7
8
- // IsJobSucceeded returns true if the job completed and did not fail
8
+ // IsJobSucceeded returns true if the job completed
9
9
func IsJobSucceeded (job * batchv1.Job ) bool {
10
10
for _ , con := range job .Status .Conditions {
11
11
if con .Type == batchv1 .JobComplete && con .Status == corev1 .ConditionTrue {
@@ -15,10 +15,13 @@ func IsJobSucceeded(job *batchv1.Job) bool {
15
15
return false
16
16
}
17
17
18
- // IsJobFinished returns true if the job has completed
18
+ // IsJobFinished returns true if the job has finished, i.e. is completed, failed or suspended
19
+ // Technically a suspended job can be resumed, but the logic in jx assume this doesn't happen
20
+ // Reference: https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#jobstatus-v1-batch
19
21
func IsJobFinished (job * batchv1.Job ) bool {
20
22
for _ , con := range job .Status .Conditions {
21
- if con .Status == corev1 .ConditionTrue {
23
+ if (con .Type == batchv1 .JobComplete || con .Type == batchv1 .JobFailed || con .Type == batchv1 .JobSuspended ) &&
24
+ con .Status == corev1 .ConditionTrue {
22
25
return true
23
26
}
24
27
}
You can’t perform that action at this time.
0 commit comments