How can I convert an existing Jenkins jobs to DSL Script?

Issue

  • 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? 

Environment

  • CloudBees Jenkins Enterprise

Resolution

If you just want to backup the Jenkins Job configuration, you can use the SCM Sync configuration plugin. It automatically commits every job modification to a SCM.

For DSL scripting, there is either:

  • Jenkins Pipeline: A suite of plugins that lets you orchestrate automation, simple or complex.
  • 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 on Github wiki. 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.

Unfortunately, none of theses plugins can automatically convert existing job configuration to a script. The YAML Project Plugin can do that but the plugin is at its early stage.

Have more questions? Submit a request

0 Comments

Article is closed for comments.