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

Re: Determine when a deployment finishes programmatically

On Fri, Jul 8, 2016 at 7:10 PM, Rich Megginson <rmeggins redhat com> wrote:
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.

I'd say it depends what the end use will be.

If the only concern is about limiting the execution with a timeout, then there's the `timeout` command (from the coreutils rpm).

@Alex, when using `oc get --watch`, probably you want to combine that with an alternative output format, like json, jsonpath or template.
Then act upon every new output.

Or maybe I just interpreted you wrong and all you want is some programmatic way the current deployment state? (complete, failed, running)
And not *wait for it to finish*?

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