How to get the revision of latest deployment in openshift?

5/31/2019

We trying to run openshift command via jenkins, as automation pipeline. If we run

oc rollout latest dc/myapp 

it triggers the deployment and jenkins job is completed as success. We are not able to identify, whether triggered openshift deployment is successful or failed.

As one of the solution, we thought to get status of the latest deployment, run while loop until status is complete.

we thought of using below command :

oc rollout history dc/<name> --revision=1

But, problem with it is , we are not able to get revision number of latest deployment.

Is this right approach, if not what can be the way to find out whether open-shift deployment is failed or successful ?

Thank you.

-- sup570
kubernetes
openshift

1 Answer

5/31/2019

you can watch the status of latest roleout with the following command

oc rollout status dc/<name>

you can get more information with oc rollout --help command

if you want a specific condition to be true on specific resource, you can also use the oc waitcommand

oc wait --help

-- Suresh Vishnoi
Source: StackOverflow