gitlab-branch-source-plugin icon indicating copy to clipboard operation
gitlab-branch-source-plugin copied to clipboard

configure using groovy

Open apallares19 opened this issue 2 years ago • 1 comments

Describe your use-case which is not covered by existing documentation.

Hello, can someone tell me how to configure this feature using groovy file?

branchSources { branchSource { source { gitlab { // Select the GitLab Server where you want the projects to be discovered from. serverName('default') // Specify the namespace which owns your projects. projectOwner('gitlab-group') // Select the project on which you want to perform the Multibranch Pipeline Job. projectPath('gitlab_group/REPO_NAME') // Checkout credentials is only needed for private projects. credentialsId('gitlab') id('gitlab_group/REPO_NAME') //projectId(long value). ----> what is this value for????? traits { // gitLabBranchDiscovery{ // strategyId(1) // } } } } } }

I'm currently using the feature through jenkins ui but i could'nt configure it using jenkins groovy.

Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.

No response

apallares19 avatar Jan 30 '23 21:01 apallares19

Hi @apallares19 ,

Thank you for thinking of putting the code in markdown tags so that it is more readable for us.

the projectId is the Id of your Gitlab project. You can see it in the Gitlab IHM : image

I don't have job DSL in my Jenkins. But If you can propose a complete working example in the README, that would be cool.

Describe your use-case which is not covered by existing documentation.

Hello, can someone tell me how to configure this feature using groovy file?

branchSources { 
 branchSource { 
   source { 
     gitlab { 
       // Select the GitLab Server where you want the projects to be discovered from. 
       serverName('default') 
       // Specify the namespace which owns your projects. 
       projectOwner('gitlab-group') 
       // Select the project on which you want to perform the Multibranch Pipeline Job. 
       projectPath('gitlab_group/REPO_NAME') 
       // Checkout credentials is only needed for private projects. 
       credentialsId('gitlab') 
       id('gitlab_group/REPO_NAME') 
       //projectId(long value). ----> what is this value for????? 
       traits { 
         // gitLabBranchDiscovery{ 
           // strategyId(1) 
         // }
       } 
     }
   }
 }
}

I'm currently using the feature through jenkins ui but i could'nt configure it using jenkins groovy.

Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.

No response

Turiok avatar Mar 25 '23 08:03 Turiok