Skip to end of metadata
Go to start of metadata

Use this plugin to convert your current jobs in Job DSL scripts (see Job DSL Plugin for more informations)

Instructions

You can find the plugin on sidepanel of Jenkins.

1 - Select the jobs you want to convert.

2 - You can check the "Create view for all selected jobs" and give it a name

3 - Click on "Convert selected to DSL" button

4 - Now you can Download the file, copy the script itself

5 - Below we have the Non-translated section, if you need some of these tags translated, please, create an issue on https://github.com/jenkinsci/xml-job-to-job-dsl-plugin

Version History

Version 0.1 (02/01/2018)

Initial version

 

 

13 Comments

  1. yan-hong wang

    did you find it?

    it's listed in the sidepanel, at left

    please, let me know if it is not appearing there

    1. Hello Alan Quintiliano

       

      Yes, I found it.

      But, when I use that, I found some Jenkins jobs doesn't support to convert to DSL.

      For example, mavenJob. That will show 'null'.

      And some configuration of pipeline job don't support, too.

      But, by the way, it's awesome enough.

       

      BR

      Hong

    2. Hello Alan Quintiliano

       

      and some message like:

       

      The following tags couldn't be translated to DSL:

      • actions
      • org.jenkinsci.plugins.workflow.job.properties.DisableConcurrentBuildsJobProperty
      • configVersion
      • doGenerateSubmoduleConfigurations
      • gitTool
      • submoduleCfg
      • hudson.plugins.git.extensions.impl.SparseCheckoutPaths
      • hudson.plugins.git.extensions.impl.CloneOption
      • lightweight

       

      BR

      Hong

  2. yes, there's a lot of tags unsupported yet, I have written the minimum I needed for my purposes but I decided to let everyone to use and contribute to it, so, if you want to make the code support the tags you need, you can fork my repository and then create a PR, I will be really happy to accept your changes

    the repository is: https://github.com/jenkinsci/xml-job-to-job-dsl-plugin

    a
    ny doubts on it, please, tell me, but it should be really easy to create new tags

    1. Hi Alan Quintiliano

      I am thinking about if that's possible to generate "dynamic DSL code", not DSL in hard code.

      Hong

      1. I am really curious, how would you do that?

  3. I have a problem with the cucumberTestResults plugin. I tried to include the example from the documentation into my dsl file but it doesn`t work.


    job('example') {
        publishers {
            cucumberTestResults {
                jsonReportFiles('files.json')
                ignoreBadSteps()
            }
        }
    }

    Do you have any idea how i can resolve that?

    1. hi Hans Dieters, what exactly did you try?

      You are trying to make the plugin supports the cucumberTestResults?

      Or you are trying to add this part of code in the generated DSL (by the plugin)?

      if you are just trying to add this part of code, you will need to find (if exists) the publishers tag in the generated DSL, then add the 

      cucumberTestResults {
          jsonReportFiles('files.json')
          ignoreBadSteps()
      }

       

      it would be helpful if you could write the full error you are getting

      1. Thanks for your reply.

        The context is that I tried to convert my xml file, where cucumber reports were included as a post-build action, into a dsl file with your plugin. Because that was not supported, I tried to include 

         

        cucumberTestResults {
            jsonReportFiles('files.json')
            ignoreBadSteps()
        }
        directly into my dsl file. But no cucumber reports are being generated after I run my job. I don't know if the documentation is wrong or if it's just my mistake.
        1. ok, if you generated the DSL using my plugin, and now you are trying to insert more (unsupported) tags, you will need to take a look in the documentation of the  Job DSL Plugin , this is not about my converter anymore

          but I will try to help you, did you find the publishers tag in the generated DSL?

          if possible, send me the generated file

          1. Now I found what I was looking for.

             

            publishers {
                    cucumber {
                        fileIncludePattern('**/*.json')
                    }
                }

             

            Is the correct publisher for the cucumber reports.

            Thanks for your help.

            1. glad you found it out!

  4. The following tags couldn't be translated to DSL:

    • actions
    • trim
    • trim
    • trim
    • trim
    • trim
    • trim
    • trim
    • trim
    • trim
    • trim
    • sandbox
    • on
    • canRoam
    • jdk
    • EnvInjectBuilder
    • org.jenkinsci.plugins.conditionalbuildstep.singlestep.SingleConditionalBuilder
    • caseSensitive
    • externalDelete
    • org.jenkinsci.plugins.buildnamesetter.BuildNameSetter