jenkins.scm.api.SCMNavigator Java Examples
The following examples show how to use
jenkins.scm.api.SCMNavigator.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GithubScmContentProvider.java From blueocean-plugin with MIT License | 6 votes |
@Override public String getApiUrl(@Nonnull Item item) { if (item instanceof OrganizationFolder) { List<SCMNavigator> navigators = ((OrganizationFolder) item).getSCMNavigators(); if ((!navigators.isEmpty() && navigators.get(0) instanceof GitHubSCMNavigator)) { return ((GitHubSCMNavigator) navigators.get(0)).getApiUri(); } } else if (item instanceof MultiBranchProject) { List<SCMSource> sources = ((MultiBranchProject) item).getSCMSources(); if ((!sources.isEmpty() && sources.get(0) instanceof GitHubSCMSource)) { return ((GitHubSCMSource) sources.get(0)).getApiUri(); } } return null; }
Example #2
Source File: GitLabMergeRequestSCMEvent.java From gitlab-branch-source-plugin with MIT License | 6 votes |
@Override public String descriptionFor(@NonNull SCMNavigator navigator) { String state = getPayload().getObjectAttributes().getState(); if (state != null) { switch (state) { case "opened": return "Merge request !" + getPayload().getObjectAttributes().getIid() + " opened in project " + getPayload() .getProject().getName(); case "reopened": return "Merge request !" + getPayload().getObjectAttributes().getIid() + " reopened in project " + getPayload() .getProject().getName(); case "closed": return "Merge request !" + getPayload().getObjectAttributes().getIid() + " closed in project " + getPayload() .getProject().getName(); } } return "Merge request !" + getPayload().getObjectAttributes().getIid() + " event in project " + getPayload().getProject() .getName(); }
Example #3
Source File: AbstractGithubOrganization.java From blueocean-plugin with MIT License | 6 votes |
@Override public boolean isJenkinsOrganizationPipeline() { for(TopLevelItem item: Jenkins.getInstance().getItems()){ if(item instanceof OrganizationFolder){ OrganizationFolder folder = (OrganizationFolder) item; for(SCMNavigator navigator: folder.getNavigators()) { if (navigator instanceof GitHubSCMNavigator) { GitHubSCMNavigator scmNavigator = (GitHubSCMNavigator) navigator; if(scmNavigator.getRepoOwner().equals(getName())){ return true; } } } } } return false; }
Example #4
Source File: BitbucketOrg.java From blueocean-plugin with MIT License | 6 votes |
@Override public boolean isJenkinsOrganizationPipeline() { for(TopLevelItem item: Jenkins.getInstance().getItems()){ if(item instanceof OrganizationFolder){ OrganizationFolder folder = (OrganizationFolder) item; for(SCMNavigator navigator: folder.getNavigators()) { if (navigator instanceof BitbucketSCMNavigator) { BitbucketSCMNavigator scmNavigator = (BitbucketSCMNavigator) navigator; if(scmNavigator.getRepoOwner().equals(getName())){ return true; } } } } } return false; }
Example #5
Source File: ScmContentProviderParams.java From blueocean-plugin with MIT License | 6 votes |
@SuppressWarnings("unchecked") public ScmContentProviderParams(Item item) { String apiUrl = null; String owner=null; String repo = null; if (item instanceof OrganizationFolder) { List<SCMNavigator> navigators = ((OrganizationFolder) item).getSCMNavigators(); if (!navigators.isEmpty()) { SCMNavigator navigator = navigators.get(0); apiUrl = apiUrl(navigator); owner = owner(navigator); } } else if (item instanceof MultiBranchProject) { List<SCMSource> sources = ((MultiBranchProject) item).getSCMSources(); if (!sources.isEmpty()) { SCMSource source = sources.get(0); apiUrl = apiUrl(source); owner = owner(source); repo = repo(source); } } this.apiUrl = apiUrl == null ? GitHubSCMSource.GITHUB_URL : apiUrl;; this.owner = owner; this.repo = repo; this.credentials = getCredentialForUser(item, this.apiUrl);; }
Example #6
Source File: GiteaPullSCMEvent.java From gitea-plugin with MIT License | 6 votes |
/** * {@inheritDoc} */ @Override public String descriptionFor(@NonNull SCMNavigator navigator) { GiteaPullRequestEventType action = getPayload().getAction(); if (action != null) { switch (action) { case OPENED: return "Pull request #" + getPayload().getNumber() + " opened in repository " + getPayload() .getRepository().getName(); case REOPENED: return "Pull request #" + getPayload().getNumber() + " reopened in repository " + getPayload() .getRepository().getName(); case CLOSED: return "Pull request #" + getPayload().getNumber() + " closed in repository " + getPayload() .getRepository().getName(); } } return "Pull request #" + getPayload().getNumber() + " event in repository " + getPayload().getRepository() .getName(); }
Example #7
Source File: PullRequestGHEventSubscriber.java From github-branch-source-plugin with MIT License | 6 votes |
@Override public String descriptionFor(@NonNull SCMNavigator navigator) { String action = getPayload().getAction(); if (action != null) { switch (action) { case "opened": return "Pull request #" + getPayload().getNumber() + " opened in repository " + repository; case "reopened": return "Pull request #" + getPayload().getNumber() + " reopened in repository " + repository; case "synchronize": return "Pull request #" + getPayload().getNumber() + " updated in repository " + repository; case "closed": return "Pull request #" + getPayload().getNumber() + " closed in repository " + repository; } } return "Pull request #" + getPayload().getNumber() + " event in repository " + repository; }
Example #8
Source File: GitLabSCMNavigatorRequest.java From gitlab-branch-source-plugin with MIT License | 5 votes |
protected GitLabSCMNavigatorRequest(@NonNull SCMNavigator source, @NonNull GitLabSCMNavigatorContext context, @NonNull SCMSourceObserver observer) { super(source, context, observer); wantSubgroupProjects = context.wantSubgroupProjects(); projectNamingStrategy = context.withProjectNamingStrategy(); }
Example #9
Source File: GithubScmContentProvider.java From blueocean-plugin with MIT License | 5 votes |
@Override protected String apiUrl(@Nonnull SCMNavigator scmNavigator) { if(scmNavigator instanceof GitHubSCMNavigator){ return ((GitHubSCMNavigator)scmNavigator).getApiUri(); } return null; }
Example #10
Source File: GithubScmContentProvider.java From blueocean-plugin with MIT License | 5 votes |
@Override protected String owner(@Nonnull SCMNavigator scmNavigator) { if(scmNavigator instanceof GitHubSCMNavigator){ return ((GitHubSCMNavigator)scmNavigator).getRepoOwner(); } return null; }
Example #11
Source File: GithubOrganizationFolder.java From blueocean-plugin with MIT License | 5 votes |
@Override public boolean isScanAllRepos() { if(!getFolder().getSCMNavigators().isEmpty()) { SCMNavigator scmNavigator = getFolder().getSCMNavigators().get(0); if(scmNavigator instanceof GitHubSCMNavigator){ GitHubSCMNavigator gitHubSCMNavigator = (GitHubSCMNavigator) scmNavigator; WildcardSCMHeadFilterTrait wildcardTraits = SCMTrait.find(gitHubSCMNavigator.getTraits(), WildcardSCMHeadFilterTrait.class); return wildcardTraits == null || ((StringUtils.isBlank(wildcardTraits.getIncludes()) || wildcardTraits.getIncludes().equals("*")) && StringUtils.isBlank(wildcardTraits.getExcludes())); } } return super.isScanAllRepos(); }
Example #12
Source File: GitLabSCMWebHookItemListener.java From gitlab-branch-source-plugin with GNU General Public License v2.0 | 5 votes |
private void onUpdated(SCMNavigatorOwner owner) { for (SCMNavigator navigator : owner.getSCMNavigators()) { if (navigator instanceof GitLabSCMNavigator) { onUpdated((GitLabSCMNavigator) navigator, owner); } } }
Example #13
Source File: GitLabSCMWebHookItemListener.java From gitlab-branch-source-plugin with GNU General Public License v2.0 | 5 votes |
private void onDeleted(SCMNavigatorOwner owner) { for (SCMNavigator navigator : owner.getSCMNavigators()) { if (navigator instanceof GitLabSCMNavigator) { unregister((GitLabSCMNavigator) navigator, owner); } } }
Example #14
Source File: GiteaCreateSCMEvent.java From gitea-plugin with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public String descriptionFor(@NonNull SCMNavigator navigator) { String ref = getPayload().getRef(); ref = ref.startsWith(Constants.R_HEADS) ? ref.substring(Constants.R_HEADS.length()) : ref; return "Create event for branch " + ref + " in repository " + getPayload().getRepository().getName(); }
Example #15
Source File: AbstractGiteaSCMSourceEvent.java From gitea-plugin with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public boolean isMatch(@NonNull SCMNavigator navigator) { if (navigator instanceof GiteaSCMNavigator) { GiteaSCMNavigator nav = (GiteaSCMNavigator) navigator; return StringUtils.equalsIgnoreCase(getPayload().getRepository().getOwner().getUsername(), nav.getRepoOwner()) && GiteaServers.isEventFor(nav.getServerUrl(), getPayload().getRepository().getHtmlUrl()); } return false; }
Example #16
Source File: AbstractGiteaSCMHeadEvent.java From gitea-plugin with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public boolean isMatch(@NonNull SCMNavigator navigator) { if (navigator instanceof GiteaSCMNavigator) { GiteaSCMNavigator nav = (GiteaSCMNavigator) navigator; return StringUtils.equalsIgnoreCase(getPayload().getRepository().getOwner().getUsername(), nav.getRepoOwner()) && GiteaServers.isEventFor(nav.getServerUrl(), getPayload().getRepository().getHtmlUrl()); } return false; }
Example #17
Source File: GiteaPushSCMEvent.java From gitea-plugin with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public String descriptionFor(@NonNull SCMNavigator navigator) { String ref = getPayload().getRef(); ref = ref.startsWith(Constants.R_HEADS) ? ref.substring(Constants.R_HEADS.length()) : ref; return "Push event to branch " + ref + " in repository " + getPayload().getRepository().getName(); }
Example #18
Source File: GiteaSCMNavigator.java From gitea-plugin with MIT License | 5 votes |
@Override public SCMNavigator newInstance(String name) { GiteaServers s = GiteaServers.get(); List<GiteaServer> servers = s == null ? Collections.<GiteaServer>emptyList() : s.getServers(); GiteaSCMNavigator navigator = new GiteaSCMNavigator(servers.isEmpty() ? null : servers.get(0).getServerUrl(), name); navigator.setTraits(getTraitsDefaults()); return navigator; }
Example #19
Source File: GiteaRepositorySCMEvent.java From gitea-plugin with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public String descriptionFor(@NonNull SCMNavigator navigator) { switch (getType()) { case CREATED: return "Creation of repository " + getPayload().getRepository().getName(); case REMOVED: return "Deletion of repository " + getPayload().getRepository().getName(); default: return super.descriptionFor(navigator); } }
Example #20
Source File: PushGHEventSubscriber.java From github-branch-source-plugin with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public String descriptionFor(@NonNull SCMNavigator navigator) { String ref = getPayload().getRef(); if (ref.startsWith(R_TAGS)) { ref = ref.substring(R_TAGS.length()); return "Push event for tag " + ref + " in repository " + repository; } if (ref.startsWith(R_HEADS)) { ref = ref.substring(R_HEADS.length()); } return "Push event to branch " + ref + " in repository " + repository; }
Example #21
Source File: GitHubSCMNavigator.java From github-branch-source-plugin with MIT License | 5 votes |
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public SCMNavigator newInstance(String name) { GitHubSCMNavigator navigator = new GitHubSCMNavigator(name); navigator.setTraits(getTraitsDefaults()); return navigator; }
Example #22
Source File: GitLabSCMNavigator.java From gitlab-branch-source-plugin with MIT License | 5 votes |
@Override public SCMNavigator newInstance(String name) { GitLabSCMNavigator navigator = new GitLabSCMNavigator(""); navigator.setTraits(getTraitsDefaults()); return navigator; }
Example #23
Source File: GitHubRepositoryEventSubscriber.java From github-branch-source-plugin with MIT License | 5 votes |
@Override protected boolean isApplicable(@Nullable Item item) { if (item instanceof SCMNavigatorOwner) { for (SCMNavigator navigator : ((SCMNavigatorOwner) item).getSCMNavigators()) { if (navigator instanceof GitHubSCMNavigator) { return true; // TODO allow navigators to opt-out } } } return false; }
Example #24
Source File: PullRequestGHEventSubscriber.java From github-branch-source-plugin with MIT License | 4 votes |
@Override public boolean isMatch(@NonNull SCMNavigator navigator) { return navigator instanceof GitHubSCMNavigator && repoOwner.equalsIgnoreCase(((GitHubSCMNavigator) navigator).getRepoOwner()); }
Example #25
Source File: PushGHEventSubscriber.java From github-branch-source-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @Override public boolean isMatch(@NonNull SCMNavigator navigator) { return navigator instanceof GitHubSCMNavigator && repoOwner.equalsIgnoreCase(((GitHubSCMNavigator) navigator).getRepoOwner()); }
Example #26
Source File: AbstractScmSourceEvent.java From blueocean-plugin with MIT License | 4 votes |
@Override public boolean isMatch(@NonNull SCMNavigator navigator) { return false; }
Example #27
Source File: GithubOrganizationFolder.java From blueocean-plugin with MIT License | 4 votes |
@Override protected OrganizationFolderPipelineImpl getFolder(jenkins.branch.OrganizationFolder folder, Reachable parent, BlueOrganization organization) { SCMNavigator navigator = Iterables.getFirst(folder.getNavigators(), null); return GitHubSCMNavigator.class.isInstance(navigator) ? new GithubOrganizationFolder(organization, folder, parent.getLink()) : null; }
Example #28
Source File: GitHubRepositoryEventSubscriber.java From github-branch-source-plugin with MIT License | 4 votes |
@Override public boolean isMatch(@NonNull SCMNavigator navigator) { return navigator instanceof GitHubSCMNavigator && isApiMatch(((GitHubSCMNavigator) navigator).getApiUri()) && repoOwner.equalsIgnoreCase(((GitHubSCMNavigator) navigator).getRepoOwner()); }
Example #29
Source File: GitHubSCMNavigatorContext.java From github-branch-source-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @NonNull @Override public GitHubSCMNavigatorRequest newRequest(@NonNull SCMNavigator navigator, @NonNull SCMSourceObserver observer) { return new GitHubSCMNavigatorRequest(navigator, this, observer); }
Example #30
Source File: GitLabTagPushSCMEvent.java From gitlab-branch-source-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @Override public String descriptionFor(@NonNull SCMNavigator navigator) { return description(); }