From a19fd954bf091ea1d77dc202e3e2008a4b071c25 Mon Sep 17 00:00:00 2001 From: Mark Lagendijk Date: Thu, 6 Dec 2018 11:07:08 +0100 Subject: [PATCH] Only override buildKey when overrideLatestBuild. This makes sure that the buildKey of BitbucketBuildStatusNotifierStep calls, are not incorrectly overriden. --- .../plugins/bitbucket/BitbucketBuildStatusHelper.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/jenkinsci/plugins/bitbucket/BitbucketBuildStatusHelper.java b/src/main/java/org/jenkinsci/plugins/bitbucket/BitbucketBuildStatusHelper.java index 5c03689..f7989b7 100644 --- a/src/main/java/org/jenkinsci/plugins/bitbucket/BitbucketBuildStatusHelper.java +++ b/src/main/java/org/jenkinsci/plugins/bitbucket/BitbucketBuildStatusHelper.java @@ -245,8 +245,8 @@ public static void notifyBuildStatus(UsernamePasswordCredentials credentials, bo // if previous build was manually aborted by the user and revision is the same than the current one // then update the bitbucket build status resource with current status and current build number for (BitbucketBuildStatusResource prevBuildStatusResource : prevBuildStatusResources) { - if (prevBuildStatusResource.getCommitId().equals(buildStatusResource.getCommitId())) { - BitbucketBuildStatus prevBuildStatus = createBitbucketBuildStatusFromBuild(prevBuild, overrideLatestBuild); + if (prevBuildStatusResource.getCommitId().equals(buildStatusResource.getCommitId()) && overrideLatestBuild) { + BitbucketBuildStatus prevBuildStatus = createBitbucketBuildStatusFromBuild(prevBuild, true); buildStatus.setKey(prevBuildStatus.getKey()); break;