LD250 / jenkins-cli-python

Jenkins command line interface written in python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

download job config

gagomes opened this issue · comments

It would be fantastic if this tool made it possible to download jenkins job configs, i.e build plans

@gagomes So, the python-jenkins library which jenkins-cli depends on provides a get_job_config function which returns the job config in XML format. An example of the returned value:

<?xml version='1.0' encoding='UTF-8'?>
<project>
  <actions/>
  <description></description>
  <keepDependencies>false</keepDependencies>
  <properties/>
  <scm class="hudson.scm.NullSCM"/>
  <canRoam>true</canRoam>
  <disabled>false</disabled>
  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
  <triggers/>
  <concurrentBuild>false</concurrentBuild>
  <builders>
    <hudson.tasks.Shell>
      <command>for i in $(seq 1000); do
    echo $i
    sleep 1
done
</command>
    </hudson.tasks.Shell>
  </builders>
  <publishers/>
  <buildWrappers/>
</project>

Adding a command which would output such a xml string would be fairly easy.

For me, the output of project.builders would be useful. Is this what you meant by build plans? Or is there some other part of the job config xml you are interested in?

The xml of the job config is exactly what I was suggesting. I am currently using python-jenkins as my work around.

Thank you.