- We are in process of taking backup of all existing jobs and we want to convert all existing jenkins jobs to DSL Script to save them in SCM…
- Is there a way we can convert all existing jenkins jobs to DSL Script?
- CloudBees Jenkins Enterprise
If you just want to backup the Jenkins Job configuration, you can use the SCM Sync configuration plugin (https://wiki.jenkins-ci.org/display/JENKINS/SCM+Sync+configuration+plugin). It automatically commits every job modification to a SCM.
For DSL scripting, there is either:
- JobDSL plugin: a Groovy DSL to create and configure job programmatically. JobDSL scripts can be stored in a SCM and job reconfiguration can even be triggered on commit on this repository. The plugin has a extensive documentation (https://wiki.jenkins-ci.org/display/JENKINS/Job+DSL+Plugin). It can be difficult to start with but it’s very powerful.
- Literate plugin: a plugin using a file in the project source to explain on how to build the project. Documentation is here: (https://wiki.jenkins-ci.org/display/JENKINS/Literate+Plugin)
Unfortunately, none of theses plugins can automatically convert existing job configuration to a script. The YAML Project Plugin (https://wiki.jenkins-ci.org/display/JENKINS/YAML+Project+Plugin) can do that but the plugin is at its early stage.