Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,14 @@
import hudson.scm.SCMRevisionState;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.lang.IllegalStateException;
import jenkins.scm.api.SCMHead;
import jenkins.scm.api.SCMSource;
import jenkins.scm.api.SCMSourceOwner;
import org.jenkinsci.plugins.displayurlapi.DisplayURLProvider;


/**
* This class encapsulates all Bitbucket notifications logic.
* {@link JobCompletedListener} sends a notification to Bitbucket after a build finishes.
Expand All @@ -69,7 +72,11 @@ private static void createBuildCommitStatus(@NonNull Run<?,?> build, @NonNull Ta
String url;
try {
url = DisplayURLProvider.get().getRunURL(build);
} catch (IllegalStateException e) {
URI testURI = new URI(url);
if (!testURI.getHost().contains(".")) {
throw new IllegalStateException("Jenkins RootURL not a FQDN");
}
} catch (IllegalStateException|java.net.URISyntaxException e) {
listener.getLogger().println("Can not determine Jenkins root URL. Commit status notifications are disabled until a root URL is configured in Jenkins global configuration.");
return;
}
Expand Down