Skip to content

Commit

Permalink
Merge pull request #20 from Flagbit/flagbit-33901
Browse files Browse the repository at this point in the history
Fix JENKINS-33901 add support for ssh on 443 port
  • Loading branch information
Antonio Mansilla committed May 6, 2016
2 parents ed69c7d + feba62b commit 66a0a89
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
Expand Up @@ -44,6 +44,7 @@
import org.jenkinsci.plugins.bitbucket.model.BitbucketBuildStatus;
import org.jenkinsci.plugins.bitbucket.model.BitbucketBuildStatusResource;
import org.jenkinsci.plugins.bitbucket.model.BitbucketBuildStatusSerializer;
import org.jenkinsci.plugins.bitbucket.validator.BitbucketHostValidator;
import org.jenkinsci.plugins.multiplescms.MultiSCM;
import org.kohsuke.stapler.AncestorInPath;
import org.kohsuke.stapler.DataBoundConstructor;
Expand All @@ -54,6 +55,7 @@
public class BitbucketBuildStatusNotifier extends Notifier {

private static final Logger logger = Logger.getLogger(BitbucketBuildStatusNotifier.class.getName());
private static final BitbucketHostValidator hostValidator = new BitbucketHostValidator();

private boolean notifyStart;
private boolean notifyFinish;
Expand Down Expand Up @@ -193,8 +195,8 @@ private List<BitbucketBuildStatusResource> createBuildStatusResources(final Abst

// if repo is not hosted in bitbucket.org then log it and remove repo from being notified
URIish repoUri = commitRepoPair.getValue();
if (!repoUri.getHost().equals("bitbucket.org")) {
logger.log(Level.INFO, "Bitbucket build notifier support only repositories hosted in bitbucket.org");
if (!hostValidator.isValid(repoUri.getHost())) {
logger.log(Level.INFO, hostValidator.renderError());
continue;
}

Expand Down
@@ -0,0 +1,19 @@
package org.jenkinsci.plugins.bitbucket.validator;

import com.google.common.collect.ImmutableSet;
import java.util.Set;

public class BitbucketHostValidator
{
final Set<String> supportedDomains = ImmutableSet.of("bitbucket.org", "altssh.bitbucket.org");

public boolean isValid(final String $value)
{
return this.supportedDomains.contains($value);
}

public String renderError()
{
return "Bitbucket build notifier support only repositories hosted in bitbucket.org";
}
}

0 comments on commit 66a0a89

Please sign in to comment.