Skip to content

Commit

Permalink
Fix setting end time for aborted builds
Browse files Browse the repository at this point in the history
  • Loading branch information
nikita-tkachenko-datadog committed Feb 7, 2024
1 parent f8080c7 commit 2559d10
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ of this software and associated documentation files (the "Software"), to deal
import org.datadog.jenkins.plugins.datadog.util.TagsUtil;
import org.datadog.jenkins.plugins.datadog.util.git.GitUtils;
import org.jenkinsci.plugins.workflow.cps.EnvActionImpl;
import org.jenkinsci.plugins.workflow.graph.FlowNode;

public class BuildData implements Serializable {

Expand Down Expand Up @@ -203,7 +204,7 @@ public BuildData(Run<?, ?> run, @Nullable TaskListener listener) throws IOExcept
durationInMs = System.currentTimeMillis() - startTime;
}
this.duration = durationInMs;
if (duration != 0 && startTime != 0 && isCompleted) {
if (duration != 0 && startTime != 0 && !run.isBuilding()) {
this.endTime = startTime + duration;
}

Expand Down

0 comments on commit 2559d10

Please sign in to comment.