Hide Forgot
Created attachment 1196156 [details] Duration on build page Description of problem: On build page, there includes 2 lines: Started: 8 minutes ago ... Duration: running for ... minutes, ... seconds While in CLI, the output of `oc get build` also includes "STARTED" and "DURATION" (in columns). The above 2 lines on build page correspond to the 2 columns in CLI. However, given local date is not sync with server, when a build is running, its duration is not correct on build page, which is calculated by "local time - build's metadata.creationTimestamp". This is wrong and does not correspond to the DURATION value in `oc get build`. Note: but after the build is complete, its Duration on build page suddenly changes to as correct as CLI shows. Version-Release number of selected component (if applicable): openshift v3.3.0.27 How reproducible: Always Steps to Reproduce: 1. Start a build 2. When build is running: 1> Check the value after "Duration" on build page https://<master>:8443/console/project/<your_project>/browse/builds/<bc>/<build> 2> Check the duration via CLI $ oc get build Actual results: 2. The value after "Duration" seems calculated by "local time - build's metadata.creationTimestamp". When local time is not sync with server, it is wrong. Here are an example in which case local time is about 7 mins earlier than server: 1> See attachment, Duration begins from 7 mins and increments every seconds 2> $ oc get build NAME TYPE FROM STATUS STARTED DURATION ruby-sample-build-2 Source Git@e79d887 Running 8 minutes ago 30s Expected results: 2. 1> Duration should be displayed like DURATION column of `oc get build` Additional info: This bug is not talking about "Started" but "Duration". Though the "Started" line/column is wrong too, it would not be fixed as per https://bugzilla.redhat.com/show_bug.cgi?id=1299328#c2
*** Bug 1377868 has been marked as a duplicate of this bug. ***
The CLI only needs to make a single request, the API is calculating duration at the time of the GET request and returning it. The console on the other hand is getting the build and then opening a websocket to watch for changes to the build. We get the initial value of duration calculated by the API, but since there is no change to actual stored data no watch event is fired so we never get an updated duration from the server.
Also see https://github.com/openshift/origin/issues/2568
In 4.x, we calculate the build duration using the value from the API, so this should be a non-issue: https://github.com/openshift/console/blob/88dc7f8343826e710e052ec559657648cd97a07a/frontend/public/module/k8s/builds.ts#L42-L56