-
Bug
-
Resolution: Unresolved
-
Minor
-
None
Inside a Global Pipeline Library I have this code
def call(imageName, dockerBuildArgs='') { build_key = "building-${imageName}" build_desc = "Building docker image ${imageName}" echo "Using bitbucket buildKey - ${build_key}" bitbucketStatusNotify(buildState: 'INPROGRESS', buildKey: build_key, buildName: build_key, buildDescription: build_desc) // more code }
Which produces this in the build log :-
16:51:43 Using bitbucket buildKey - building-ui [Pipeline] bitbucketStatusNotify 16:51:44 Sending build status INPROGRESS for commit 799491ecfb6a7d91729f3e36bfc62b95cd939169 to BitBucket is done! 16:51:44 Sending build status INPROGRESS for commit 799491ecfb6a7d91729f3e36bfc62b95cd939169 to BitBucket is done!
But it produces this in the Jenkins log file
Oct 27, 2017 4:51:44 PM org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusHelper sendBuildStatusNotification INFO: This request was sent: { "state": "INPROGRESS", "key": "043c101ede9fa607e95bb2cdb59b7134", "url": "https://[jenkins_url]/job/[job-name]/job/ui/job/PR-59/2/", "name": "building-ui", "description": "Building docker image ui" }
If I re-run the same Job I get this in the jenkins log
Oct 30, 2017 10:55:57 AM org.jenkinsci.plugins.bitbucket.BitbucketBuildStatusHelper sendBuildStatusNotification INFO: This request was sent: { "state": "SUCCESSFUL", "key": "building-ui", "url": "https://[jenkins_url]/job/[job-name]/job/ui/job/PR-59/3/", "name": "building-ui", "description": "Building docker image ui" }
It looks to me like the buildKey is somehow reset to null and it falls back to generate a key based on the job name. The result of this issue is that each PR that should have 4 build statuses in BitBucket ends up with a single status.
Also I'd like to add that I have other functions within the same Global Pipeline Library that also use the bitbucketStatusNotify function that result in the same buildKey being used.
Ideally I'd like to limit BitBucket to only allow PR's to be merged once it has 4 Successful statuses, but I can't currently use this as sometimes the PR only has one even though everything passed successfully.
I'd really appreciate some help getting to the bottom of this, and I'm will to supply any other required details.