Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

configure using groovy #275

Open
apallares19 opened this issue Jan 30, 2023 · 1 comment
Open

configure using groovy #275

apallares19 opened this issue Jan 30, 2023 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@apallares19
Copy link

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 apallares19 added the documentation Improvements or additions to documentation label Jan 30, 2023
@Turiok
Copy link
Contributor

Turiok commented Mar 25, 2023

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants