In my experience, this is a completely manual rewriting process. Reference material is located at https://jenkinsci.imtqy.com/job-dsl-plugin/# .
Many elements in xml defaults, so most xml can be skipped. You only need to convert the xml element by element if the DSL does not directly support the plugin or the plugin function that you configured.
The conversion process is as follows:
- Go through each configured property (via the Jenkins GUI), for example. Discard old builds.
- Determine if DSL has built-in support for this item. If so, rewrite it in DSL. For example, logRotator provides the "Undo old builds" functionality.
- If DSL is not directly supported, you need to manually use configure to output xml. This is quite complicated and can be avoided, if at all possible.
If you donβt know which plugin provides the job item, you can often see the plugin name in the help text for that item (click the small question mark icon). Otherwise, the xml element often contains the name of the plugin.
It is also useful to know that job items are split equally in DSL, as they are on the Jenkins Configure screen. Therefore, if it is a trigger, you can find it in DSL under triggers .
A simple example (I know yours is much more complicated):
freeStyleJob("Arthur Example") { description('Description') logRotator(30) }
source share