ktdreyer / jenkins-job-wrecker

convert Jenkins job XML to JJB YAML
MIT License
162 stars 69 forks source link

cannot handle XML #16

Open cdenneen opened 8 years ago

cdenneen commented 8 years ago
# jjwrecker -f /var/lib/jenkins/jobs/test/config.xml -n "test"
cannot handle XML org.jenkinsci.plugins.gitlablogo.GitlabLogoProperty
last called handle_triggers
Traceback (most recent call last):
  File "/usr/bin/jjwrecker", line 9, in <module>
    load_entry_point('jenkins-job-wrecker==1.0.6', 'console_scripts', 'jjwrecker')()
  File "/usr/lib/python2.7/site-packages/jenkins_job_wrecker/cli.py", line 179, in main
    yaml = root_to_yaml(root, args.name)
  File "/usr/lib/python2.7/site-packages/jenkins_job_wrecker/cli.py", line 75, in root_to_yaml
    settings = handler(child)
  File "/usr/lib/python2.7/site-packages/jenkins_job_wrecker/job_handlers.py", line 540, in handle_triggers
    raise NotImplementedError("cannot handle XML %s" % child.tag)
NotImplementedError: cannot handle XML com.dabsquared.gitlabjenkins.GitLabPushTrigger
<?xml version='1.0' encoding='UTF-8'?>
<project>
  <actions/>
  <description></description>
  <keepDependencies>false</keepDependencies>
  <properties>
    <org.jenkinsci.plugins.gitlablogo.GitlabLogoProperty plugin="gitlab-logo@1.0.1">
      <repositoryName></repositoryName>
    </org.jenkinsci.plugins.gitlablogo.GitlabLogoProperty>
    <jenkins.plugins.slack.SlackNotifier_-SlackJobProperty plugin="slack@1.8.1">
      <teamDomain></teamDomain>
      <token></token>
      <room></room>
      <startNotification>false</startNotification>
      <notifySuccess>false</notifySuccess>
      <notifyAborted>false</notifyAborted>
      <notifyNotBuilt>false</notifyNotBuilt>
      <notifyUnstable>false</notifyUnstable>
      <notifyFailure>false</notifyFailure>
      <notifyBackToNormal>false</notifyBackToNormal>
      <notifyRepeatedFailure>false</notifyRepeatedFailure>
      <includeTestSummary>false</includeTestSummary>
      <showCommitList>false</showCommitList>
      <includeCustomMessage>false</includeCustomMessage>
      <customMessage></customMessage>
    </jenkins.plugins.slack.SlackNotifier_-SlackJobProperty>
  </properties>
  <scm class="hudson.plugins.git.GitSCM" plugin="git@2.4.1">
    <configVersion>2</configVersion>
    <userRemoteConfigs>
      <hudson.plugins.git.UserRemoteConfig>
        <url>https://gitlab.domain.git/puppet/puppet-module.git</url>
      </hudson.plugins.git.UserRemoteConfig>
    </userRemoteConfigs>
    <branches>
      <hudson.plugins.git.BranchSpec>
        <name>*/master</name>
      </hudson.plugins.git.BranchSpec>
    </branches>
    <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
    <submoduleCfg class="list"/>
    <extensions/>
  </scm>
  <canRoam>true</canRoam>
  <disabled>false</disabled>
  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
  <triggers>
    <com.dabsquared.gitlabjenkins.GitLabPushTrigger plugin="gitlab-plugin@1.1.28">
      <spec></spec>
      <triggerOnPush>true</triggerOnPush>
      <triggerOnMergeRequest>true</triggerOnMergeRequest>
      <triggerOpenMergeRequestOnPush>both</triggerOpenMergeRequestOnPush>
      <ciSkip>true</ciSkip>
      <setBuildDescription>true</setBuildDescription>
      <addNoteOnMergeRequest>true</addNoteOnMergeRequest>
      <addCiMessage>true</addCiMessage>
      <addVoteOnMergeRequest>true</addVoteOnMergeRequest>
      <allowAllBranches>false</allowAllBranches>
      <includeBranchesSpec></includeBranchesSpec>
      <excludeBranchesSpec></excludeBranchesSpec>
      <acceptMergeRequestOnSuccess>false</acceptMergeRequestOnSuccess>
    </com.dabsquared.gitlabjenkins.GitLabPushTrigger>
  </triggers>
  <concurrentBuild>false</concurrentBuild>
  <builders/>
  <publishers>
    <hudson.plugins.warnings.WarningsPublisher plugin="warnings@4.52">
      <healthy></healthy>
      <unHealthy></unHealthy>
      <thresholdLimit>low</thresholdLimit>
      <pluginName>[WARNINGS] </pluginName>
      <defaultEncoding></defaultEncoding>
      <canRunOnFailed>false</canRunOnFailed>
      <usePreviousBuildAsReference>false</usePreviousBuildAsReference>
      <useStableBuildAsReference>false</useStableBuildAsReference>
      <useDeltaValues>false</useDeltaValues>
      <thresholds plugin="analysis-core@1.76">
        <unstableTotalAll></unstableTotalAll>
        <unstableTotalHigh></unstableTotalHigh>
        <unstableTotalNormal></unstableTotalNormal>
        <unstableTotalLow></unstableTotalLow>
        <unstableNewAll></unstableNewAll>
        <unstableNewHigh></unstableNewHigh>
        <unstableNewNormal></unstableNewNormal>
        <unstableNewLow></unstableNewLow>
        <failedTotalAll></failedTotalAll>
        <failedTotalHigh></failedTotalHigh>
        <failedTotalNormal></failedTotalNormal>
        <failedTotalLow></failedTotalLow>
        <failedNewAll></failedNewAll>
        <failedNewHigh></failedNewHigh>
        <failedNewNormal></failedNewNormal>
        <failedNewLow></failedNewLow>
      </thresholds>
      <shouldDetectModules>false</shouldDetectModules>
      <dontComputeNew>true</dontComputeNew>
      <doNotResolveRelativePaths>true</doNotResolveRelativePaths>
      <includePattern></includePattern>
      <excludePattern></excludePattern>
      <messagesPattern></messagesPattern>
      <parserConfigurations/>
      <consoleParsers>
        <hudson.plugins.warnings.ConsoleParser>
          <parserName>Puppet-Lint</parserName>
        </hudson.plugins.warnings.ConsoleParser>
      </consoleParsers>
    </hudson.plugins.warnings.WarningsPublisher>
  </publishers>
  <buildWrappers/>
</project>
cdenneen commented 8 years ago

Since JJB handles raw XML inline would it be useful for the parts it can't convert properly to just configure those to become raw xml?

similar to:

      triggers: |
        <hudson.triggers.SCMTrigger>
          <spec>*/5 * * * *</spec>
        </hudson.triggers.SCMTrigger>
ktdreyer commented 8 years ago

I think that's a really great idea to just write out the XML for stanzas that JJW cannot translate to YAML. I'd happily merge a pull request that does that!

jlove4m commented 8 years ago

Ran into this today with the shelveproject plugin.