Re-running a Failed Build Job Appends a New Build to PR
dthagard opened this issue · 1 comments
Concourse CI Version
v3.14.1
Configuration
anchors:
- &ci-callback-url
url: https://<REDACTED>/teams/$BUILD_TEAM_NAME/pipelines/$BUILD_PIPELINE_NAME/jobs/$BUILD_JOB_NAME/builds/$BUILD_NAME
- &pullrequest-hook-params
name: ci test
<<: *ci-callback-url
- &ci-failure
on_failure:
put: pull-requests
params:
<<: *pullrequest-hook-params
state: FAILED
description: "Failed"
Debug Output
{"key": "ci test-16063", "description": "Failed", "repository": {"links": {"self": {"href": "https://bitbucket.org/!api/2.0/repositories/<REDACTED>/<REDACTED>"}, "html": {"href": "https://bitbucket.org/<REDACTED>/<REDACTED>"}, "avatar": {"href": "https://bytebucket.org/ravatar/%<REDACTED>%7D?ts=js"}}, "type": "repository", "name": "<REDACTED>", "full_name": "<REDACTED>/<REDACTED>", "uuid": "{<REDACTED>}"}, "url": "https://<REDACTED>/teams/<REDACTED>/pipelines/<REDACTED>/jobs/ci/builds/1", "links": {"commit": {"href": "https://bitbucket.org/!api/2.0/repositories/<REDACTED>/<REDACTED>/commit/<REDACTED>"}, "self": {"href": "https://bitbucket.org/!api/2.0/repositories/<REDACTED>/<REDACTED>/commit/<REDACTED>/statuses/build/ci%20test-16063"}}, "refname": null, "state": "FAILED", "created_on": "2018-08-16T19:00:14.306608+00:00", "commit": {"hash": "<REDACTED>", "type": "commit", "links": {"self": {"href": "https://bitbucket.org/!api/2.0/repositories/<REDACTED>/<REDACTED>/commit/<REDACTED>"}, "html": {"href": "https://bitbucket.org/<REDACTED>/<REDACTED>/commits/<REDACTED>"}}}, "updated_on": "2018-08-16T19:12:25.310277+00:00", "type": "build", "name": "ci test"}
Expected Behavior
After a failed CI build, if the user clicks the '+' button to trigger a new build of the same CI job and the job passes, the Bitbucket PR should show the build as passing.
Actual Behavior
After a failed CI build, if the user clicks the '+' button to trigger a new build of the same CI job and the job passes, the Bitbucket PR shows two builds on the PR--one passing build and one failing build. If the user has the merge check Check the last commit for N successful build and no failed builds
enabled, the user will be unable to merge the PR until a new commit is pushed.
Steps to Reproduce
- Create a repository in Bitbucket Cloud.
- Create a branch permission on the default branch and set the merge check for
Check the last commit for 1 successful build and no failed builds
. - Create a CI job in Concourse with the
concourse-git-bitbucket-pr-resource
configured to post back to the PRon_failure
(see sample config above). - Configure the CI job to fail by default.
- Create a new branch from the default branch.
- Commit a change to the new branch.
- Submit a PR to the default branch.
- Observe the failed build result.
- Fix the CI job to succeed.
- Re-run the CI job via the build trigger in the Concourse CI web console (or via CLI).
- Observe that two builds are posted back to the PR and that the user is unable to merge the PR.
Important Factoids
The current behavior when re-running a failed build on a PR in Bitbucket Pipelines is to set the key on the build status to the same key as the previous build thereby updating the same build status. This PR updates this resource to behave in a similar manner as the Bitbucket Pipelines product.