[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Determine when a deployment finishes programmatically



On 07/08/2016 11:00 AM, Rodolfo Carvalho wrote:
I'm testing my proposed solution using `oc get --watch`

Then I just remembered another trick I've used:


oc logs -f dc/ruby-hello-world


If the deployment has started, you can stream the logs and the oc call will block until the deployment finishes.

I was told that, in general, it is better to poll for status with a timeout [1] than rely on `oc logs -f ...something...` [2].

[1] https://github.com/openshift/origin/blob/719eb73481e0270d31f49eb53a26c333a6496943/hack/lib/cmd.sh#L132
[2] https://github.com/openshift/origin-aggregated-logging/pull/192 - see the Conversation and the followups under comment 3.  You'll have to "Show 5 comments" to see them.



Rodolfo Carvalho | OpenShift

On Fri, Jul 8, 2016 at 6:46 PM, Alex Wauck <alexwauck exosite com> wrote:
That's kind of helpful.  I tried --watch for one of my deployments, and I got this result:

$ oc get rc/watcher-17 --watch
NAME         DESIRED   CURRENT   AGE
watcher-17   1         1         12s
watcher-17   2         1         55s
watcher-17   2         1         55s
watcher-17   2         2         55s
watcher-17   2         2         1m
watcher-17   2         2         1m

So, if I don't know how many replicas it's supposed to have, then this output doesn't tell me when it's done.  Not very helpful.  Also, the CLI seems to think that the old rc has 0 replicas before the web UI does.  Kind of strange.

On Fri, Jul 8, 2016 at 11:20 AM, Rodolfo Carvalho <rcarvalh redhat com> wrote:
Hi Alex,

The way our tests wait for a deployment to finish is like this:



The key part there is using the watch API.


I think there's no CLI command that would give you as much flexibility as the API today, but you could try to do something on top of

$ oc get dc/... --watch / --watch-only


You'd react to every new output until you see the desired state.


Rodolfo Carvalho | OpenShift

On Fri, Jul 8, 2016 at 6:02 PM, Alex Wauck <alexwauck exosite com> wrote:
No luck:
$ oc get rc -l deploymentconfig=$PROJECT,deployment=$PROJECT-12
$ oc describe rc/$PROJECT-12
Name: $PROJECT-12
Namespace: $PROJECT
Selector: app=$PROJECT,deployment=$PROJECT-12,deploymentconfig=$PROJECT
Replicas: 2 current / 2 desired
Pods Status: 1 Running / 1 Waiting / 0 Succeeded / 0 Failed
No volumes.
Events:
  FirstSeen LastSeen Count From SubobjectPath Type Reason Message
  --------- -------- ----- ---- ------------- -------- ------ -------
  1m 1m 1 {replication-controller } Normal SuccessfulCreate Created pod: $PROJECT-12-7udpy
  38s 38s 1 {replication-controller } Normal SuccessfulCreate Created pod: $PROJECT-12-dvjp8


On Fri, Jul 8, 2016 at 9:57 AM, Clayton Coleman <ccoleman redhat com> wrote:
oc get rc -l deploymentconfig=NAME,deployment=# should show you

On Jul 8, 2016, at 10:07 AM, Alex Wauck <alexwauck exosite com> wrote:

Is there any decent way to determine when a deployment has completed?  I've tried `oc get deployments`, which never shows me anything, even when I have a deployment in progress.  I can go into the web UI and see a list of deployments, but I can't find any way to access that information via the CLI aside from parsing the very machine-unfriendly output of `oc describe dc/whatever`.

How does the web UI get that information?  It doesn't have any special access that the CLI doesn't, does it?

--
Alex Wauck // DevOps Engineer
E X O S I T E 
www.exosite.com  Making Machines More Human.
_______________________________________________
users mailing list
users lists openshift redhat com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users



--
Alex Wauck // DevOps Engineer
E X O S I T E 
www.exosite.com  Making Machines More Human.

_______________________________________________
users mailing list
users lists openshift redhat com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users





--
Alex Wauck // DevOps Engineer
E X O S I T E 
www.exosite.com  Making Machines More Human.



_______________________________________________
users mailing list
users lists openshift redhat com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]