-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
oc deploy --latest can't wait for the deployment and return correct exist status #10864
Comments
the openshift jenkins plugin already supports waiting for a deployment to complete if you so choose. you can use that either as a build step, or from the jenkins pipeline plugin.
|
@smarterclayton isn't think a use-case for the |
@bparees that's a bit specific just to the subset of pipelines using DSL (which we are not using); but good to know. Additionally, |
@mfojtik not really. This is basically what |
And at the same time have a new deployment start, in order to trick |
@mfojtik I think you added the --wait flag for start-build. It should be the same here I guess. I am just not sure I want to duplicate the work |
no, it's usable from any pipeline, whether you use the DSL or not, and also any standard jenkins job using the "trigger a deployment" build step. but i agree that it would be preferable to not have to use jenkins to get this behavior. |
@Kargakis |
@Kargakis yeah, |
@mfojtik yes and you will need to take care of exit codes. Did you do something similar for start-build? |
yes Michal Fojtik On 9 September 2016 at 17:25:25, Michail Kargakis ([email protected])
|
A couple of notes and an alternative proposal:
I am proposing a
@mfojtik @openshift/cli-review @smarterclayton thoughts? |
@Kargakis please explain - is there any analog for oc rollout status for jobs? are there any workarounds - how to see the rollout status for one job ? (oc get jobs is useless with CI/CD) |
Hi, I've been facing the same situation. After reading this thread and done some tests I've realized it's possible to use oc rollout status with CI/CD to determine if the rollout was completed successfully. You can see my tests bellow: Monitoring the status without stopping the deploy using the web console:
Monitoring the status while I stop the deploy using the web console:
So, it's possible to use the code above to monitor one deploy and fail the CI/CD if necessary. An example of Jenkins's pipeline code could be:
Besides, I believe is important to know that if you start a build it will start a deployment right after completing the build. So, you must either use something like |
For people that are controlling OpenShift from scripts, there needs to be a way to rollout a new deployment and wait for it, returning meaningful exist code.
Right now the closest seems to be using
oc deploy --latest --follow
that waits for the deployment to finish, but does not tell you if it actually got deployed or failed. (It returns 0 even if the deployment fails; rightfully, because it followed just the logs and that went fine.)This is a major problem when you want to control the deployment from a script or pipeline.
Let's consider the following use case:
oc deploy --latest
to rollout the new version2.1 wait for it and make sure it got deployed or fail
You have to know that it got deployed successfully at step 2. otherwise it makes no sense to run those tests.
This should be done in the same command with a flag like
--wait
. It will be quite common operation e.g. in pipelines.(I am aware this functionality is moving to
oc rollout
, but I did not want to reference it since it's not merged yet. I am fine with fixing this just there, not inoc deploy
.)@Kargakis This is the one we discussed over IRC a bit.
It's pipeline related so @bparees might be interested or have some good insights.
The text was updated successfully, but these errors were encountered: