Hi All, 


I need an example of a JobDSL that can create a Jenkins multi branch 
pipeline job that is working against Bitbucket and configures the option of 
bitbucketTrustTeam.


An example that works for me with the "configure" DSL command follows: 

    configure {

        it / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'source' 
/ traits / 
'com.cloudbees.jenkins.plugins.bitbucket.ForkPullRequestDiscoveryTrait' {

            strategyId(1)

            trust(class: 
"com.cloudbees.jenkins.plugins.bitbucket.ForkPullRequestDiscoveryTrait\$TrustTeamForks")

        }

    }


What I need is to rewrite it in a more professional way with the pure DSL, 
something like

                         bitbucketForkDiscovery {

                             strategyId(1)

                             trust(bitbucketTrustTeam)

                         }

but having no success in passing the trust parameter, and having little 
experience in the matter I would like to ask the community for any help on 
the subject.


Regards,

Dmitri


An example that needs rewriting is here:


multibranchPipelineJob('my-build') {

    displayName(‘my-build-multi-branch-pipeline')

    description('My project')

    branchSources {

        branchSource {

            source {

                bitbucket {

                     id('my-build-pipeline')

                     serverUrl('https://bitbucket.<domain> ')

                     credentialsId('bitbucket_creds')

                     repoOwner('~myaccount')

                     repository('my_repo')

                     traits {

                         bitbucketBranchDiscovery {

                             strategyId(1)

                         }

                         bitbucketPullRequestDiscovery {

                             strategyId(1)

                         }

//                         bitbucketForkDiscovery {

//                             strategyId(1)

//                             trust(bitbucketTrustTeam)

//                         }

                         bitbucketTagDiscovery()

                     }

                }

            }

            buildStrategies {

                skipInitialBuildOnFirstBranchIndexing()

                buildNamedBranches {

                    filters {

                        regex {

                            
regex('master|development|feature-.+|staging-\\d+')

                            caseSensitive(false)

                        }

                    }

               

                }

                buildTags {

                    atLeastDays('0')

                    atMostDays('2')

                }

                buildChangeRequests {

                    ignoreTargetOnlyChanges(false)

                    ignoreUntrustedChanges(true)

                } 

            }

        }

        factory {

            workflowBranchProjectFactory {

                scriptPath('my_build_multibranch.jenkinsfile')

            }

        }

    }

    configure {

        it / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'source' 
/ traits / 
'com.cloudbees.jenkins.plugins.bitbucket.ForkPullRequestDiscoveryTrait' {

            strategyId(1)

            trust(class: 
"com.cloudbees.jenkins.plugins.bitbucket.ForkPullRequestDiscoveryTrait\$TrustTeamForks")

        }

    }

    orphanedItemStrategy {

        discardOldItems {

            daysToKeep(30)

            numToKeep(2)

        }

    }

}

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2df3eec4-3d87-4c31-84c1-2d7de5f4e5bf%40googlegroups.com.

Reply via email to