Skip to content

Commit 764dea9

Browse files
ctatar01ctatar01
ctatar01
authored and
ctatar01
committed
Added a warning message for issue jenkinsci#2
1 parent 42e2e83 commit 764dea9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/main/java/com/cloudbees/jenkins/plugins/bitbucket/BitbucketBuildStatusNotifications.java

+8-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@
2323
*/
2424
package com.cloudbees.jenkins.plugins.bitbucket;
2525

26+
import java.io.File;
27+
28+
import org.jenkinsci.plugins.displayurlapi.DisplayURLProvider;
29+
2630
import com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketApi;
2731
import com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketBuildStatus;
2832
import com.cloudbees.plugins.credentials.common.StandardUsernamePasswordCredentials;
@@ -44,11 +48,9 @@
4448
import hudson.plugins.mercurial.MercurialTagAction;
4549
import hudson.scm.SCM;
4650
import hudson.scm.SCMRevisionState;
47-
import java.io.File;
4851
import jenkins.scm.api.SCMHead;
4952
import jenkins.scm.api.SCMSource;
5053
import jenkins.scm.api.SCMSourceOwner;
51-
import org.jenkinsci.plugins.displayurlapi.DisplayURLProvider;
5254

5355
/**
5456
* This class encapsulates all Bitbucket notifications logic.
@@ -65,6 +67,10 @@ private static void createBuildCommitStatus(@NonNull Run<?,?> build, @NonNull Ta
6567
if (revision != null) {
6668
Result result = build.getResult();
6769
String url = DisplayURLProvider.get().getRunURL(build);
70+
if (url == null || url.contains("unconfigured-jenkins-location")) {
71+
listener.getLogger().println("[Bitbucket] In order for most Bitbucket API requests to work the 'Jenkins URL' of the Jenkins instance must be set.");
72+
listener.getLogger().println("[Bitbucket] 'url' field for this API request is set to: " + url);
73+
}
6874
BitbucketBuildStatus status = null;
6975
if (Result.SUCCESS.equals(result)) {
7076
status = new BitbucketBuildStatus(revision, "This commit looks good", "SUCCESSFUL", url, build.getParent().getName(), build.getDisplayName());

0 commit comments

Comments
 (0)