Search in sources :

Example 1 with BranchBuildStrategy

use of jenkins.branch.BranchBuildStrategy in project gitlab-branch-source-plugin by Argelbargel.

the class GitLabSCMItemListener method updateBranchBuildStrategies.

private boolean updateBranchBuildStrategies(MultiBranchProject<?, ?> project) {
    boolean changed = false;
    for (BranchSource branchSource : project.getSources()) {
        if (GitLabSCMBranchBuildStrategy.INSTANCE.isApplicable(branchSource)) {
            List<BranchBuildStrategy> strategies = new ArrayList<>(branchSource.getBuildStrategies());
            if (!strategies.contains(GitLabSCMBranchBuildStrategy.INSTANCE)) {
                strategies.add(GitLabSCMBranchBuildStrategy.INSTANCE);
                branchSource.setBuildStrategies(strategies);
                changed = true;
            }
        }
    }
    return changed;
}
Also used : BranchBuildStrategy(jenkins.branch.BranchBuildStrategy) ArrayList(java.util.ArrayList) BranchSource(jenkins.branch.BranchSource)

Aggregations

ArrayList (java.util.ArrayList)1 BranchBuildStrategy (jenkins.branch.BranchBuildStrategy)1 BranchSource (jenkins.branch.BranchSource)1