-
Notifications
You must be signed in to change notification settings - Fork 923
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to kubectl wait for job completion regardless of success or failure #1629
Comments
There are no sig labels on this issue. Please add an appropriate label by using one of the following commands:
Please see the group list for a listing of the SIGs, working groups, and committees available. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/transfer kubectl |
/kind feature |
Just noticed from the docs that "The completion time is only set when the job finishes successfully.". Hence this will not work in my case when the job fails. Is there other singular value in the job status that represents the completion (finish) of the job, regardless of whether it failed or succeeded? |
Related issue #1224 See possible workaround in this comment #1224 (comment) Relevant Stack Overflow https://stackoverflow.com/questions/55073453/wait-for-kubernetes-job-to-complete-on-either-failure-success-using-command-line |
/triage accepted |
As @mpuckett159 mentioned, I created a plugin to help with this. Install:
Usage:
Output with be either:
|
We are running AKS and use Azure DevOps with kubectl task to deploy our application. Before we deploy the actual application, we are running a data migration job. We want to wait for this job in the Azure DevOps pipeline, however the only option so far is to:
kubectl wait --for=condition=complete --timeout=600s job/somejob
In this case the pipeline task would only exit if the job has completed or the timeout has elapsed. In the case the job fails we are left with just waiting for timeout. I looked at using
kubectl wait --for=jsonpath
but there is no single value (and i mean single as in singular, not a combination of different values) in the output returned by kubectl that would indicate the job has finished, regardless of whether it succeeded or failed. And due to kubectl not supporting and/or conditions in jsonpath I am not able to evaluate the job completion based on multiple values. The only field that represents true completion is when.status.completionTime
is set. I tried just out of curiosity doingkubectl wait --for=jsonpath={.status.completionTime}
, and the task did indeed wait for the job once .status.completionTime was set, however docs suggest the condition would be met if the value I look for is True, but obviously completionTime is not. Is there any docs that would indicate howwait --for=jsonpath
behaves on the fields that are set dynamically (like.status.completionTime
) during the job execution?The text was updated successfully, but these errors were encountered: