ktdreyer / jenkins-job-wrecker

convert Jenkins job XML to JJB YAML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Pipelines support

nikodamn opened this issue Β· comments

Hi! I just wanted to say massive thank you for this tool. It works perfectly, is easy to setup and saves a lot of time. GJ! πŸŽ‰

I wanted to ask if Jenkins' pipelines are already supported or maybe do you have it on your roadmap? I tried to extract pipeline into YAML, but it's getting saved as XML. Still this is better then nothing, but I'd be nice to have it in YAML, right? ;)

Sorry for creating an issue which basically is a question, but I couldn't find better place to post it. And again - good job with it πŸ‘

Thanks Nikodem!

If you provide the YAML that jenkins-job-wrecker generated, it'll give us an idea of what a patch would look like. Even better, if you could provide the entire raw job's XML from the Jenkins master in addition, then we'll have something we could use to drive a test case.

Thanks for the quick reply, @ktdreyer ! Here you are:

  1. YAML generated by jj-wrecker:
- job:
    name: !!python/unicode 'example-pipeline-test'
    xml:
      raw:
        xml: |-
          <flow-definition plugin="workflow-job@2.11">
          <actions />
          <description>Example</description>
          <keepDependencies>false</keepDependencies>
          <properties>
          <com.sonyericsson.rebuild.RebuildSettings plugin="rebuild@1.25">
          <autoRebuild>false</autoRebuild>
          <rebuildDisabled>false</rebuildDisabled>
          </com.sonyericsson.rebuild.RebuildSettings>
          <hudson.plugins.throttleconcurrents.ThrottleJobProperty plugin="throttle-concurrents@1.9.0">
          <maxConcurrentPerNode>0</maxConcurrentPerNode>
          <maxConcurrentTotal>0</maxConcurrentTotal>
          <categories class="java.util.concurrent.CopyOnWriteArrayList" />
          <throttleEnabled>false</throttleEnabled>
          <throttleOption>project</throttleOption>
          <limitOneJobWithMatchingParams>false</limitOneJobWithMatchingParams>
          <paramsToUseForLimit />
          </hudson.plugins.throttleconcurrents.ThrottleJobProperty>
          <org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
          <triggers />
          </org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
          </properties>
          <definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" plugin="workflow-cps@2.31">
          <script>// This shows a simple build wrapper example, using the AnsiColorBuildWrapper plugin.
          node {
          // This is the current syntax for invoking a build wrapper, naming the class.
          wrap([$class: 'AnsiColorBuildWrapper']) {
          // Just some echoes to show the ANSI color.
          stage "\u001B[31mI'm Red\u001B[0m Now not"
          }
          }</script>
          <sandbox>true</sandbox>
          </definition>
          <triggers />
          <disabled>false</disabled>
          </flow-definition>
  1. XML from Jenkins config.xml
<flow-definition plugin="workflow-job@2.11">
<actions/>
<description>Example</description>
<keepDependencies>false</keepDependencies>
<properties>
<com.sonyericsson.rebuild.RebuildSettings plugin="rebuild@1.25">
<autoRebuild>false</autoRebuild>
<rebuildDisabled>false</rebuildDisabled>
</com.sonyericsson.rebuild.RebuildSettings>
<hudson.plugins.throttleconcurrents.ThrottleJobProperty plugin="throttle-concurrents@1.9.0">
<maxConcurrentPerNode>0</maxConcurrentPerNode>
<maxConcurrentTotal>0</maxConcurrentTotal>
<categories class="java.util.concurrent.CopyOnWriteArrayList"/>
<throttleEnabled>false</throttleEnabled>
<throttleOption>project</throttleOption>
<limitOneJobWithMatchingParams>false</limitOneJobWithMatchingParams>
<paramsToUseForLimit/>
</hudson.plugins.throttleconcurrents.ThrottleJobProperty>
<org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
<triggers/>
</org.jenkinsci.plugins.workflow.job.properties.PipelineTriggersJobProperty>
</properties>
<definition class="org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition" plugin="workflow-cps@2.31">
<script>
// This shows a simple build wrapper example, using the AnsiColorBuildWrapper plugin. node { // This is the current syntax for invoking a build wrapper, naming the class. wrap([$class: 'AnsiColorBuildWrapper']) { // Just some echoes to show the ANSI color. stage "\u001B[31mI'm Red\u001B[0m Now not" } }
</script>
<sandbox>true</sandbox>
</definition>
<triggers/>
<disabled>false</disabled>
</flow-definition>

This is the simplest pipeline job only with description and example pipeline script. Thanks in advance!

@nikodamn @ktdreyer I'd like to see this issue revived... I'm going to do some looking into it to see how easy it would be to add.

@nikodamn Just wanted to ping you and let you know that pipeline support has been added πŸ˜„ . Let me know if you find any issues/bugs with it.

That's awesome! Thanks, I'll tests it later