public String getSearchUrl() { return getUrlName(); }
/** * Used to test if what we have in the job configuration matches what was submitted to the notification endpoint. * It is better to match loosely and wastes a few polling calls than to be pedantic and miss the push notification, * especially given that Git tends to support multiple access protocols. * @param lhs left-hand side of comparison * @param rhs right-hand side of comparison * @return true if left-hand side loosely matches right-hand side */ public static boolean looselyMatches(URIish lhs, URIish rhs) { return StringUtils.equals(lhs.getHost(),rhs.getHost()) && StringUtils.equals(normalizePath(lhs.getPath()), normalizePath(rhs.getPath())); }
static void setSafeParametersForTest(String parameters) { safeParameters = csvToSet(parameters != null ? parameters : SAFE_PARAMETERS); }
private boolean match(SCM scm, URIish url) { if (scm instanceof GitSCM) { for (RemoteConfig remoteConfig : ((GitSCM) scm).getRepositories()) { for (URIish urIish : remoteConfig.getURIs()) { // needed cause the ssh and https URI differs in Bitbucket Server. if(urIish.getPath().startsWith("/scm")){ urIish = urIish.setPath(urIish.getPath().substring(4)); } LOGGER.log(Level.FINE, "Trying to match {0} ", urIish.toString() + "<-->" + url.toString()); if (GitStatus.looselyMatches(urIish, url)) { return true; } } } } else if (scm instanceof MercurialSCM) { try { URI hgUri = new URI(((MercurialSCM) scm).getSource()); String remote = url.toString(); if (looselyMatches(hgUri, remote)) { return true; } } catch (URISyntaxException ex) { LOGGER.log(Level.SEVERE, "Could not parse jobSource uri: {0} ", ex); } } return false; }
lastSHA1 = sha1; lastBuildParameters = null; GitStatus.clearLastStaticBuildParameters(); URIish uri; List<ParameterValue> buildParameters = new ArrayList<>();
if (GitStatus.looselyMatches(u, remote)) { SCMHead head = new SCMHead(branch); for (SCMHeadPrefilter filter: ctx.prefilters()) {
URIish matchedURL = null; for (URIish remoteURL : repository.getURIs()) { if (looselyMatches(uri, remoteURL)) { repositoryMatches = true; matchedURL = remoteURL;
/** * Used to test if what we have in the job configuration matches what was * submitted to the notification endpoint. It is better to match loosely and * wastes a few polling calls than to be pedantic and miss the push * notification, especially given that Git tends to support multiple access * protocols. */ public static boolean looselyMatches(URIish lhs, URIish rhs) { return StringUtils.equals(lhs.getHost(), rhs.getHost()) && StringUtils.equals(normalizePath(lhs.getPath()), normalizePath(rhs.getPath())); }
public String getSearchUrl() { return getUrlName(); }
if (GitStatus.looselyMatches(uri, remoteURL)) { for (BranchSpec branchSpec : git.getBranches()) { if (branchSpec.getName().contains("$")) {
if (GitStatus.looselyMatches(uri, remoteURL)) { for (BranchSpec branchSpec : git.getBranches()) { if (branchSpec.getName().contains("$")) {
branchMatches = false; for (URIish remoteURL : repository.getURIs()) { if (looselyMatches(uri, remoteURL)) { repositoryMatches = true; break;
@Override public boolean isMatch(SCMSource source) { if (source instanceof GitSCMSource) { GitSCMSource git = (GitSCMSource) source; GitSCMSourceContext ctx = new GitSCMSourceContext<>(null, SCMHeadObserver.none()) .withTraits(git.getTraits()); if (ctx.ignoreOnPushNotifications()) { return false; } URIish remote; try { remote = new URIish(git.getRemote()); } catch (URISyntaxException e) { // ignore return false; } if (GitStatus.looselyMatches(u, remote)) { notified[0] = true; return true; } return false; } return false; }
if (GitStatus.looselyMatches(uri, remote)) { LOGGER.info("Triggering the indexing of " + owner.getFullDisplayName() + " as a result of event from " + origin);