From 2559d10a90db918ef41e44302db7ff917cdb5032 Mon Sep 17 00:00:00 2001 From: Nikita Tkachenko Date: Wed, 7 Feb 2024 16:14:00 +0100 Subject: [PATCH] Fix setting end time for aborted builds --- .../org/datadog/jenkins/plugins/datadog/model/BuildData.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/datadog/jenkins/plugins/datadog/model/BuildData.java b/src/main/java/org/datadog/jenkins/plugins/datadog/model/BuildData.java index a0821236..cac6201d 100644 --- a/src/main/java/org/datadog/jenkins/plugins/datadog/model/BuildData.java +++ b/src/main/java/org/datadog/jenkins/plugins/datadog/model/BuildData.java @@ -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 { @@ -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; }