Search in sources :

Example 1 with BranchDiscoveryTrait

use of jenkins.plugins.git.traits.BranchDiscoveryTrait in project blueocean-plugin by jenkinsci.

the class GitPipelineCreateRequest method createSource.

@Override
protected SCMSource createSource(@Nonnull MultiBranchProject project, @Nonnull BlueScmConfig scmConfig) {
    GitSCMSource gitSource = new GitSCMSource(StringUtils.defaultString(scmConfig.getUri()));
    gitSource.setCredentialsId(computeCredentialId(scmConfig));
    List<SCMSourceTrait> traits = gitSource.getTraits();
    traits.add(new BranchDiscoveryTrait());
    traits.add(new CleanBeforeCheckoutTrait());
    traits.add(new CleanAfterCheckoutTrait());
    traits.add(new LocalBranchTrait());
    return gitSource;
}
Also used : CleanAfterCheckoutTrait(jenkins.plugins.git.traits.CleanAfterCheckoutTrait) SCMSourceTrait(jenkins.scm.api.trait.SCMSourceTrait) CleanBeforeCheckoutTrait(jenkins.plugins.git.traits.CleanBeforeCheckoutTrait) GitSCMSource(jenkins.plugins.git.GitSCMSource) LocalBranchTrait(jenkins.plugins.git.traits.LocalBranchTrait) BranchDiscoveryTrait(jenkins.plugins.git.traits.BranchDiscoveryTrait)

Aggregations

GitSCMSource (jenkins.plugins.git.GitSCMSource)1 BranchDiscoveryTrait (jenkins.plugins.git.traits.BranchDiscoveryTrait)1 CleanAfterCheckoutTrait (jenkins.plugins.git.traits.CleanAfterCheckoutTrait)1 CleanBeforeCheckoutTrait (jenkins.plugins.git.traits.CleanBeforeCheckoutTrait)1 LocalBranchTrait (jenkins.plugins.git.traits.LocalBranchTrait)1 SCMSourceTrait (jenkins.scm.api.trait.SCMSourceTrait)1