jenkins.scm.api.trait.SCMSourceRequest Java Examples
The following examples show how to use
jenkins.scm.api.trait.SCMSourceRequest.
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: BranchDiscoveryTrait.java From github-branch-source-plugin with MIT License | 6 votes |
/** * {@inheritDoc} */ @Override public boolean isExcluded(@NonNull SCMSourceRequest request, @NonNull SCMHead head) { if (head instanceof BranchSCMHead && request instanceof GitHubSCMSourceRequest) { for (GHPullRequest p : ((GitHubSCMSourceRequest) request).getPullRequests()) { GHRepository headRepo = p.getHead().getRepository(); if (headRepo != null // head repo can be null if the PR is from a repo that has been deleted && p.getBase().getRepository().getFullName().equalsIgnoreCase(headRepo.getFullName()) && p.getHead().getRef().equals(head.getName())) { return false; } } return true; } return false; }
Example #2
Source File: BranchDiscoveryTrait.java From gitlab-branch-source-plugin with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public boolean isExcluded(@NonNull SCMSourceRequest request, @NonNull SCMHead head) { if (head instanceof BranchSCMHead && request instanceof GitLabSCMSourceRequest) { for (MergeRequest m : ((GitLabSCMSourceRequest) request).getMergeRequests()) { // only match if the merge request is an origin merge request if (m.getSourceProjectId().equals(m.getTargetProjectId()) && m.getSourceBranch().equalsIgnoreCase(head.getName())) { return true; } } } return false; }
Example #3
Source File: BranchDiscoveryTrait.java From gitlab-branch-source-plugin with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public boolean isExcluded(@NonNull SCMSourceRequest request, @NonNull SCMHead head) { if (head instanceof BranchSCMHead && request instanceof GitLabSCMSourceRequest) { for (MergeRequest m : ((GitLabSCMSourceRequest) request).getMergeRequests()) { if (m.getSourceProjectId().equals(m.getTargetProjectId()) && !m.getSourceBranch().equalsIgnoreCase(head.getName())) { return true; } } } return false; }
Example #4
Source File: PendingChecksFilter.java From gerrit-code-review-plugin with Apache License 2.0 | 5 votes |
@Override public boolean isExcluded(SCMSourceRequest request, SCMHead head) throws IOException, InterruptedException { if (head instanceof ChangeSCMHead) { return !((GerritSCMSourceRequest) request) .getPatchsetWithPendingChecks() .containsKey( String.format( "%d/%d", ((ChangeSCMHead) head).getChangeNumber(), ((ChangeSCMHead) head).getPatchSetNumber())); } return true; }
Example #5
Source File: BranchDiscoveryTrait.java From github-branch-source-plugin with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public boolean isExcluded(@NonNull SCMSourceRequest request, @NonNull SCMHead head) { if (head instanceof BranchSCMHead && request instanceof GitHubSCMSourceRequest) { for (GHPullRequest p : ((GitHubSCMSourceRequest) request).getPullRequests()) { GHRepository headRepo = p.getHead().getRepository(); if (headRepo != null // head repo can be null if the PR is from a repo that has been deleted && p.getBase().getRepository().getFullName().equalsIgnoreCase(headRepo.getFullName()) && p.getHead().getRef().equals(head.getName())) { return true; } } } return false; }
Example #6
Source File: BranchDiscoveryTrait.java From gitea-plugin with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public boolean isExcluded(@NonNull SCMSourceRequest request, @NonNull SCMHead head) { if (head instanceof BranchSCMHead && request instanceof GiteaSCMSourceRequest) { for (GiteaPullRequest p : ((GiteaSCMSourceRequest) request).getPullRequests()) { if (p.getHead() == null || p.getHead().getRepo() == null || p.getHead().getRepo().getOwner() == null || p.getHead().getRepo().getName() == null || p.getHead().getRef() == null ) { // the head has already been deleted, so ignore as we cannot build yet JENKINS-60825 // TODO figure out if we can build a PR who's head has been deleted as it should be possible return true; } // only match if the pull request is an origin pull request if (StringUtils.equalsIgnoreCase( p.getBase().getRepo().getOwner().getUsername(), p.getHead().getRepo().getOwner().getUsername()) && StringUtils.equalsIgnoreCase( p.getBase().getRepo().getName(), p.getHead().getRepo().getName()) && StringUtils.equals(p.getHead().getRef(), head.getName())) { return true; } } } return false; }
Example #7
Source File: BranchDiscoveryTrait.java From gitea-plugin with MIT License | 5 votes |
/** * {@inheritDoc} */ @Override public boolean isExcluded(@NonNull SCMSourceRequest request, @NonNull SCMHead head) { if (head instanceof BranchSCMHead && request instanceof GiteaSCMSourceRequest) { for (GiteaPullRequest p : ((GiteaSCMSourceRequest) request).getPullRequests()) { if (p.getHead() == null || p.getHead().getRepo() == null || p.getHead().getRepo().getOwner() == null || p.getHead().getRepo().getName() == null || p.getHead().getRef() == null ) { // the head has already been deleted, so ignore as we cannot build yet JENKINS-60825 // TODO figure out if we can build a PR who's head has been deleted as it should be possible return true; } if (StringUtils.equalsIgnoreCase( p.getBase().getRepo().getOwner().getUsername(), p.getHead().getRepo().getOwner().getUsername()) && StringUtils.equalsIgnoreCase( p.getBase().getRepo().getName(), p.getHead().getRepo().getName()) && StringUtils.equals(p.getHead().getRef(), head.getName())) { return false; } } return true; } return false; }
Example #8
Source File: OriginPullRequestDiscoveryTrait.java From github-branch-source-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @Override protected boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull ChangeRequestSCMHead2 head) { return SCMHeadOrigin.DEFAULT.equals(head.getOrigin()); }
Example #9
Source File: OriginMergeRequestDiscoveryTrait.java From gitlab-branch-source-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @Override protected boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull ChangeRequestSCMHead2 head) { return SCMHeadOrigin.DEFAULT.equals(head.getOrigin()); }
Example #10
Source File: ForkPullRequestDiscoveryTrait.java From github-branch-source-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @Override protected boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull PullRequestSCMHead head) { return true; }
Example #11
Source File: ForkPullRequestDiscoveryTrait.java From github-branch-source-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @Override public boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull PullRequestSCMHead head) { return false; }
Example #12
Source File: BranchDiscoveryTrait.java From github-branch-source-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @Override protected boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull BranchSCMHead head) { return true; }
Example #13
Source File: TagDiscoveryTrait.java From github-branch-source-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @Override protected boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull GitHubTagSCMHead head) { return true; }
Example #14
Source File: OriginPullRequestDiscoveryTrait.java From gitea-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @Override protected boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull ChangeRequestSCMHead2 head) { return SCMHeadOrigin.DEFAULT.equals(head.getOrigin()); }
Example #15
Source File: ForkPullRequestDiscoveryTrait.java From gitea-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @Override protected boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull PullRequestSCMHead head) { return true; }
Example #16
Source File: ForkPullRequestDiscoveryTrait.java From gitea-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @Override public boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull PullRequestSCMHead head) { return false; }
Example #17
Source File: BranchDiscoveryTrait.java From gitea-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @Override protected boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull BranchSCMHead head) { return true; }
Example #18
Source File: TagDiscoveryTrait.java From gitea-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @Override protected boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull TagSCMHead head) { return true; }
Example #19
Source File: ForkMergeRequestDiscoveryTrait.java From gitlab-branch-source-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @Override protected boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull ChangeRequestSCMHead2 head) { return true; }
Example #20
Source File: ForkMergeRequestDiscoveryTrait.java From gitlab-branch-source-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @Override public boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull ChangeRequestSCMHead2 head) { return false; }
Example #21
Source File: BranchDiscoveryTrait.java From gitlab-branch-source-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @Override protected boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull BranchSCMHead head) { return true; }
Example #22
Source File: TagDiscoveryTrait.java From gitlab-branch-source-plugin with MIT License | 4 votes |
/** * {@inheritDoc} */ @Override protected boolean checkTrusted(@NonNull SCMSourceRequest request, @NonNull GitLabTagSCMHead head) { return true; }