-
Notifications
You must be signed in to change notification settings - Fork 168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Several Small Fixes #29
base: master
Are you sure you want to change the base?
Conversation
} | ||
|
||
// Time zone offset right now in HH:MM format | ||
public String getTimeZoneOffset() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is used to inject DST-corrected offset for the Jenkins host into the front-end (added in a small script fragment inserted into the placeholder Jelly for stage view).
@@ -181,14 +181,14 @@ function addStageTotals(runGroup) { | |||
var run = runGroup.runs[i]; | |||
|
|||
if (run.stages && (run.status === 'IN_PROGRESS' || run.status === 'PAUSED_PENDING_INPUT')) { | |||
addCompletionEstimates(run, runGroup.avgDurationMillisNoPause, runGroup.runs.length); | |||
addCompletionEstimates(run, runGroup.avgDurationMillisNoPause, endToEndRuns); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May avoid factoring incomplete runs into completion estimates. Possible fix for JENKINS-38536
@@ -238,8 +238,8 @@ function addEndTimes(jobRunsData) { | |||
* (i.e. a run, a runGroup or a stage). | |||
*/ | |||
function addCompletionEstimates(timedObject, avgDurationMillis, averagedOver) { | |||
if (averagedOver === 0) { | |||
// If no runs have completed yet, then we can't make an estimate, so just mark it at 50%. | |||
if (averagedOver === 0 || !(avgDurationMillis > 0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duration > 0 covers NaN and undefined + other weird cases.
@@ -87,6 +91,10 @@ registerHBSHelper('formatDate', function (date, toFormat) { | |||
return date; | |||
} | |||
|
|||
if (myTimeZoneOffset) { // Do time zone conversion using parseData *sigh.* | |||
//moment.locale(myTimeZone); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's where we'd inject custom formatting using Jenkins host timeZoneOffset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moment.js does have time zone offset options, though they require offset in a particular format and are a little finnicky on parsing.
@@ -21,16 +21,18 @@ | |||
<tr class="totals"> | |||
<td class="stage-start"><div class="cell-color"> | |||
Average stage times:<br /> | |||
{{#if avgDurationMillisNoPause}} | |||
{{#ifCond avgDurationMillisNoPause '>' 0 }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Covers NaN, undefined, etc.
Work in progress on JENKINS-35656.
Also part of the way towards JENKINS-36322.
Possibly resolves JENKINS-38536 and possibly not.
JENKINS-35656 Tasks:
JENKINS-36522/JENKINS-38536 Tasks:
Pushing this out as a starting point to continue work on, or for someone else to pick up from.