Bug 1371764

Summary: Running build's duration is not correct on build page when local time is not sync with server
Product: OpenShift Container Platform Reporter: Xingxing Xia <xxia>
Component: Management ConsoleAssignee: Jessica Forrester <jforrest>
Status: CLOSED WONTFIX QA Contact: Yadan Pei <yapei>
Severity: low Docs Contact:
Priority: medium    
Version: 3.3.0CC: aos-bugs, jokerman, mmccomas, spadgett, tmuma
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-28 13:53:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Duration on build page none

Description Xingxing Xia 2016-08-31 03:35:41 UTC
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

Comment 2 Jessica Forrester 2016-09-21 13:34:48 UTC
*** Bug 1377868 has been marked as a duplicate of this bug. ***

Comment 3 Jessica Forrester 2016-09-21 21:17:02 UTC
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.

Comment 4 Jessica Forrester 2016-11-21 15:09:34 UTC
Also see https://github.com/openshift/origin/issues/2568

Comment 5 Samuel Padgett 2019-10-28 13:53:28 UTC
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