简体   繁体   中英

Extract Freestyle Jobs and create pipeline Jobs in another Jenkins instance

I have two jenkins instances (jenkins1 and jenkins2)

Jenkins1 - Contains freestyle jobs (all runs on a specific template)

I need to extract all the jobs from jenkins1 and create those jobs as pipeline jobs in jenkins2.

I know simply copying the jobs doesnt work (because it is two different templates Freestyle and pipeline)

How can I do it in efficient way using a groovy/shell script to achieve this?

Every job has a config.xml where all the job step are listed in xml.

Parse that file and extract all the information than convert them in a pipeline job routine.

I think groovy/shell scripts are a perfect way to achieve it, just use the config.xml as source of information.

The below resources can help:

https://jenkinsworld20162017.sched.com/event/Bk3r/auto-convert-your-freestyle-jenkins-jobs-to-coded-pipeline?iframe=no&w=100%&sidebar=yes&bg=no

https://github.com/visualphoenix/jenkins-xml-to-jobdsl

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM