Search in sources :

Example 1 with GitLabMergeRequestFilter

use of argelbargel.jenkins.plugins.gitlab_branch_source.api.filters.GitLabMergeRequestFilter in project gitlab-branch-source-plugin by Argelbargel.

the class SourceHeads method retrieveMergeRequests.

private void retrieveMergeRequests(@CheckForNull SCMSourceCriteria criteria, @Nonnull SCMHeadObserver observer, @Nonnull TaskListener listener) throws IOException, InterruptedException {
    branchesWithMergeRequestsCache = new HashMap<>();
    if (source.getProject().isMergeRequestsEnabled() && source.getSourceSettings().shouldMonitorMergeRequests()) {
        log(listener, Messages.GitLabSCMSource_retrievingMergeRequests());
        GitLabMergeRequestFilter filter = source.getSourceSettings().createMergeRequestFilter(listener);
        for (GitLabMergeRequest mr : filter.filter(api().getMergeRequests(source.getProjectId()))) {
            checkInterrupt();
            if (!source.isExcluded(mr.getTargetBranch())) {
                observe(criteria, observer, mr, listener);
            }
        }
    }
}
Also used : GitLabMergeRequestFilter(argelbargel.jenkins.plugins.gitlab_branch_source.api.filters.GitLabMergeRequestFilter) GitLabMergeRequest(argelbargel.jenkins.plugins.gitlab_branch_source.api.GitLabMergeRequest)

Example 2 with GitLabMergeRequestFilter

use of argelbargel.jenkins.plugins.gitlab_branch_source.api.filters.GitLabMergeRequestFilter in project gitlab-branch-source-plugin by Argelbargel.

the class GitLabSCMSourceSettings method createMergeRequestFilter.

public GitLabMergeRequestFilter createMergeRequestFilter(TaskListener listener) {
    GitLabMergeRequestFilter filter = GitLabMergeRequestFilter.ALLOW_NONE;
    if (originMonitorStrategy.getMonitored()) {
        GitLabMergeRequestFilter originFilter = new AllowMergeRequestsFromOrigin(listener);
        if (originMonitorStrategy.getIgnoreWorkInProgress()) {
            originFilter = originFilter.and(new FilterWorkInProgress(listener));
        }
        filter = filter.or(originFilter);
    }
    if (forksMonitorStrategy.getMonitored()) {
        GitLabMergeRequestFilter forkFilter = new AllowMergeRequestsFromForks(listener);
        if (forksMonitorStrategy.getIgnoreWorkInProgress()) {
            forkFilter = forkFilter.and(new FilterWorkInProgress(listener));
        }
        filter = filter.or(forkFilter);
    }
    return filter;
}
Also used : AllowMergeRequestsFromOrigin(argelbargel.jenkins.plugins.gitlab_branch_source.api.filters.AllowMergeRequestsFromOrigin) GitLabMergeRequestFilter(argelbargel.jenkins.plugins.gitlab_branch_source.api.filters.GitLabMergeRequestFilter) FilterWorkInProgress(argelbargel.jenkins.plugins.gitlab_branch_source.api.filters.FilterWorkInProgress) AllowMergeRequestsFromForks(argelbargel.jenkins.plugins.gitlab_branch_source.api.filters.AllowMergeRequestsFromForks)

Aggregations

GitLabMergeRequestFilter (argelbargel.jenkins.plugins.gitlab_branch_source.api.filters.GitLabMergeRequestFilter)2 GitLabMergeRequest (argelbargel.jenkins.plugins.gitlab_branch_source.api.GitLabMergeRequest)1 AllowMergeRequestsFromForks (argelbargel.jenkins.plugins.gitlab_branch_source.api.filters.AllowMergeRequestsFromForks)1 AllowMergeRequestsFromOrigin (argelbargel.jenkins.plugins.gitlab_branch_source.api.filters.AllowMergeRequestsFromOrigin)1 FilterWorkInProgress (argelbargel.jenkins.plugins.gitlab_branch_source.api.filters.FilterWorkInProgress)1