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

New feature: override buildUrl #44

Open
wants to merge 1 commit 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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ Parameter:
| `buildKey` | String | yes | The unique key identifying the current build phase
| `buildName` | String | yes | The build phase's name shown on BitBucket
| `buildDescription` | String | yes | The build phase's description shown on BitBucket
| `buildUrl` | String | yes | The url linked to the phase in BitBucket. To link to a Jenkins artifact use `"${BUILD_URL}artifact/example.txt"`
| `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

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

private String buildUrl;
public String getBuildUrl() { return this.buildUrl; }
@DataBoundSetter public void setBuildUrl(String buildUrl) {
this.buildUrl = buildUrl;
}

private String buildState;
public String getBuildState() { return this.buildState; }

Expand Down Expand Up @@ -194,7 +200,10 @@ public Void run() throws Exception {
logger.info("Got commit id " + commitId);
logger.info("Got repo slug = " + repoSlug);

String buildUrl = BitbucketBuildStatusHelper.buildUrlFromBuild(build);
String buildUrl = step.getBuildUrl();
if (buildUrl == null) {
buildUrl = BitbucketBuildStatusHelper.buildUrlFromBuild(build);
}

BitbucketBuildStatus buildStatus = new BitbucketBuildStatus(buildState, buildKey, buildUrl, buildName,
buildDescription);
Expand Down