Groovy script to run Jenkins Job DSL to retrieve all repositories inside a Bitbucket Project

francescobabboniidsgeoradar
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 20, 2018

Hi all. 

I'm trying to develop an automatic CI chain with Jenkins, and I would like to use Jenkins Job DSL plugin in order to access (using SSH credentials) our Stash (Bitbucket) server project, in order to let Jenkins to automatically retrieve the entire set of repositories containing a Jenkinsfile inside their root folder, and generate one pipeline for each repository.

I'm not finding any helpful documentation about how to write the related Groovy script to be assigned to my Seed Job DSL item.

I noticed that there is a Job DSL API command (organizationFolder) to generate one job to generate what I need, but I really don't know how to configure it.

I found also this link https://issues.jenkins-ci.org/browse/JENKINS-46202 but I'm not so sure it could be the right solution for my issue.

Anyone can help me about it?

I'm looking for your kind reply

Thanks in advance, 

Regards

Francesco

1 answer

0 votes
Scott Schreckengaust October 8, 2018

Use the Bitbucket Branch Source Plugin and store the configuration in a credentials store for access.  One can setup a Pipeline Library so that the projects have a consistent way to build too. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events