JobDSL: an example of configuring a bitbucket source trait of bitbucketForkDiscovery in the multibranchPipelineJob is wanted

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

JobDSL: an example of configuring a bitbucket source trait of bitbucketForkDiscovery in the multibranchPipelineJob is wanted

Usov Dmitri

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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/2df3eec4-3d87-4c31-84c1-2d7de5f4e5bf%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: JobDSL: an example of configuring a bitbucket source trait of bitbucketForkDiscovery in the multibranchPipelineJob is wanted

Victor Martinez
You can use the dynamic DSL that it's specific for your installation, more precisely <your_jenkins_url>/plugin/job-dsl/api-viewer/index.html#method/jenkins.scm.api.SCMSource$$List.bitbucket

Cheers

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/8577b9f2-de09-4251-ae6e-007774ca739f%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: JobDSL: an example of configuring a bitbucket source trait of bitbucketForkDiscovery in the multibranchPipelineJob is wanted

Usov Dmitri
a fully working example will suite

On Tuesday, January 14, 2020 at 12:47:25 AM UTC+3, Victor Martinez wrote:
You can use the dynamic DSL that it's specific for your installation, more precisely <your_jenkins_url><a href="http://localhost:18080/plugin/job-dsl/api-viewer/index.html#method/jenkins.scm.api.SCMSource$$List.bitbucket" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A18080%2Fplugin%2Fjob-dsl%2Fapi-viewer%2Findex.html%23method%2Fjenkins.scm.api.SCMSource%24%24List.bitbucket\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF9KAdfHv2MAet19ekfCJAFauT8MQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Flocalhost%3A18080%2Fplugin%2Fjob-dsl%2Fapi-viewer%2Findex.html%23method%2Fjenkins.scm.api.SCMSource%24%24List.bitbucket\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF9KAdfHv2MAet19ekfCJAFauT8MQ&#39;;return true;">/plugin/job-dsl/api-viewer/index.html#method/jenkins.scm.api.SCMSource$$List.bitbucket

Further details:
- <a href="https://github.com/jenkinsci/job-dsl-plugin/wiki/Dynamic-DSL" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fjob-dsl-plugin%2Fwiki%2FDynamic-DSL\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNERL-EJFZylP-UM6rd6WSfYZ5uhSg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fjenkinsci%2Fjob-dsl-plugin%2Fwiki%2FDynamic-DSL\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNERL-EJFZylP-UM6rd6WSfYZ5uhSg&#39;;return true;">https://github.com/jenkinsci/job-dsl-plugin/wiki/Dynamic-DSL

Cheers

--
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/adb01cd3-3790-416c-9161-dd1ec1427bcc%40googlegroups.com.