I found a lot for linux bash but very few for windows... And what I'm working with Windows
Steps
You are working on Windows, you want to all your Jenkins job. So you have to- list all job
- save the jobs
and then could be able to do the import...
Batch
the save batch :java -jar jenkins-cli.jar -s http://localhost:8190/DEV/jenkins/ ...
... list-jobs > list.txt
for /f %%i in (list.txt) do java -jar jenkins-cli.jar -s ...
... http://localhost:8190/DEV/jenkins/ create-job %%i_new < %%i.xml
Note the I create a file that contains all my jobs names. Latter, when importing it will be easier to use the real job name (no deduction starting form file name)
the import batch
for /f %%i in (list.txt) do java -jar jenkins-cli.jar ...
... -s http://localhost:8190/DEV/jenkins/ create-job %%i_new < %%i.xml
Depending of your setup you could be ask for security stuff.
that's all.
No comments:
Post a Comment