Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/jenkins 35083 adding option to override build for pipeline #56

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ Parameter:
| `buildName` | String | yes | The build phase's name shown on BitBucket
| `buildDescription` | String | yes | The build phase's description shown on BitBucket
| `repoSlug`| String | yes | The slug of the bitbucket repository to send the notification to
| `commitId` | String | yes | The id of the commit to attach the status notification to
| `commitId` | String | yes | The id of the commit to attach the status notification to
| `overrideLatestBuild` | String | yes | If set to `true` will override the last build on Bitbucket (useful for requiring successful builds on pr merge). Defaults to false.

Note that the `repoSlug` and `commitId` parameters work only when they are both specified.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ public class BitbucketBuildStatusNotifierStep extends AbstractStepImpl {
this.commitId = commitId;
}

private String overrideLatestBuild;
public Boolean getOverrideLatestBuildOrDefault() {
return Boolean.valueOf(this.overrideLatestBuild);
}
@DataBoundSetter public void setOverrideLatestBuild(String overrideLatestBuild) {
this.overrideLatestBuild = overrideLatestBuild;
}

@DataBoundConstructor
public BitbucketBuildStatusNotifierStep(final String buildState) {
this.buildState = buildState;
Expand Down Expand Up @@ -199,7 +207,7 @@ public Void run() throws Exception {
BitbucketBuildStatus buildStatus = new BitbucketBuildStatus(buildState, buildKey, buildUrl, buildName,
buildDescription);

BitbucketBuildStatusHelper.notifyBuildStatus(step.getCredentials(build), false, build, taskListener, buildStatus, repoSlug, commitId);
BitbucketBuildStatusHelper.notifyBuildStatus(step.getCredentials(build), step.getOverrideLatestBuildOrDefault(), build, taskListener, buildStatus, repoSlug, commitId);

return null;
}
Expand Down