public void run() { for (SCMSource scmSource : ((SCMSourceOwner) project).getSCMSources()) { if (scmSource instanceof GitSCMSource) { GitSCMSource gitSCMSource = (GitSCMSource) scmSource; try { if (new URIish(gitSCMSource.getRemote()).equals(new URIish(gitSCMSource.getRemote()))) { if (!gitSCMSource.isIgnoreOnPushNotifications()) { LOGGER.log(Level.FINE, "Notify scmSourceOwner {0} about changes for {1}", toArray(project.getName(), gitSCMSource.getRemote())); ((SCMSourceOwner) project).onSCMSourceUpdated(scmSource); } else { LOGGER.log(Level.FINE, "Ignore on push notification for scmSourceOwner {0} about changes for {1}", toArray(project.getName(), gitSCMSource.getRemote())); } } } catch (URISyntaxException e) { // nothing to do } } } } }
private void onDeleted(SCMSourceOwner owner) { for (SCMSource source : owner.getSCMSources()) { if (source instanceof GitLabSCMSource) { unregister((GitLabSCMSource) source, owner); } } }
private void onCreated(SCMSourceOwner item) { for (SCMSource source : item.getSCMSources()) { if (source instanceof GitLabSCMSource) { register((GitLabSCMSource) source, item); } } }
@Override public void parseAssociatedNames(Item item, Collection<GitHubRepositoryName> result) { if (item instanceof SCMSourceOwner) { SCMSourceOwner sourceOwner = (SCMSourceOwner) item; for (SCMSource source : sourceOwner.getSCMSources()) { if (source instanceof GitHubSCMSource) { GitHubSCMSource gitHubSCMSource = (GitHubSCMSource) source; result.add(gitHubSCMSource.getRepoFullName()); } } } } }
@Override protected boolean isApplicable(@Nullable Item item) { if (item instanceof SCMSourceOwner) { SCMSourceOwner scmSourceOwner = (SCMSourceOwner) item; for (SCMSource source : scmSourceOwner.getSCMSources()) { if (source instanceof GitHubSCMSource) { GitHubSCMSource gitHubSCMSource = (GitHubSCMSource) source; for (GitHubHandler hubHandler : gitHubSCMSource.getHandlers()) { if (hubHandler instanceof GitHubPRHandler) { return true; } } } } } return false; }
@Override protected boolean isApplicable(@Nullable Item item) { if (item instanceof SCMSourceOwner) { SCMSourceOwner scmSourceOwner = (SCMSourceOwner) item; for (SCMSource source : scmSourceOwner.getSCMSources()) { if (source instanceof GitHubSCMSource) { GitHubSCMSource gitHubSCMSource = (GitHubSCMSource) source; for (GitHubHandler hubHandler : gitHubSCMSource.getHandlers()) { if (hubHandler instanceof GitHubBranchHandler) { return true; } } } } } return false; }
public static <ITEM extends Item> Predicate<ITEM> withBranchHandler() { return item -> { if (item instanceof SCMSourceOwner) { SCMSourceOwner scmSourceOwner = (SCMSourceOwner) item; for (SCMSource source : scmSourceOwner.getSCMSources()) { if (source instanceof GitHubSCMSource) { GitHubSCMSource gitHubSCMSource = (GitHubSCMSource) source; for (GitHubHandler hubHandler : gitHubSCMSource.getHandlers()) { if (hubHandler instanceof GitHubBranchHandler) { return true; } } } } } return false; }; } //
@Override protected boolean isApplicable(@Nullable Item project) { if (project != null) { if (project instanceof SCMSourceOwner) { SCMSourceOwner owner = (SCMSourceOwner) project; for (SCMSource source : owner.getSCMSources()) { if (source instanceof GitHubSCMSource) { return true; } } } if (project.getParent() instanceof SCMSourceOwner) { SCMSourceOwner owner = (SCMSourceOwner) project.getParent(); for (SCMSource source : owner.getSCMSources()) { if (source instanceof GitHubSCMSource) { return true; } } } } return false; }
/** * {@inheritDoc} */ @Override protected boolean isApplicable(@Nullable Item project) { if (project != null) { if (project instanceof SCMSourceOwner) { SCMSourceOwner owner = (SCMSourceOwner) project; for (SCMSource source : owner.getSCMSources()) { if (source instanceof GitHubSCMSource) { return true; } } } if (project.getParent() instanceof SCMSourceOwner) { SCMSourceOwner owner = (SCMSourceOwner) project.getParent(); for (SCMSource source : owner.getSCMSources()) { if (source instanceof GitHubSCMSource) { return true; } } } } return false; }
private boolean isFilteredBuild(AbstractPullrequest pullRequest) { BitbucketCause cause = createCause(pullRequest); //@FIXME: Way to iterate over all available SCMSources List<SCMSource> sources = new LinkedList<SCMSource>(); for(SCMSourceOwner owner : SCMSourceOwners.all()) for(SCMSource src : owner.getSCMSources()) sources.add(src); BitbucketBuildFilter filter = !this.trigger.getBranchesFilterBySCMIncludes() ? BitbucketBuildFilter.instanceByString(this.trigger.getBranchesFilter()) : BitbucketBuildFilter.instanceBySCM(sources, this.trigger.getBranchesFilter()); return filter.approved(cause); }
try { for (SCMSourceOwner owner : SCMSourceOwners.all()) { for (SCMSource source : owner.getSCMSources()) { if (source instanceof SubversionSCMSource) { if (id.equals(((SubversionSCMSource) source).getUuid())) {
@Override public void run() { for (SCMNavigatorOwner owner : Jenkins.getInstance().getAllItems(SCMNavigatorOwner.class)) { for (SCMNavigator navigator : owner.getSCMNavigators()) { if (navigator instanceof GitLabSCMNavigator) { handle((GitLabSCMNavigator) navigator, owner); } } } for (SCMSourceOwner owner : Jenkins.getInstance().getAllItems(SCMSourceOwner.class)) { for (SCMSource source : owner.getSCMSources()) { if (source instanceof GitLabSCMSource) { handle((GitLabSCMSource) source, owner); } } } }
for (SCMSource source : project.getSCMSources()) { if (!(source instanceof MercurialSCMSource)) { continue;
for (SCMSource source : owner.getSCMSources()) { if (source instanceof GitSCMSource) { GitSCMSource git = (GitSCMSource) source;