Search code examples
rubyjenkinsjenkins-cli

Get build configuration details using Jenkins API


I am looking for a way to get the configuration details of a Jenkins job using Jenkins API. Something which is displayed in the command block in the below image.

enter image description here

Has anybody tried getting configuration details using Jenkins API?


Solution

  • You can get the raw XML configuration of a job from the URL: http://jenkins:8080/job/my-job/config.xml

    This URL returns the persistent job configuration in XML. The build steps are listed under the builders element, different types of build steps are identified by different elements:

    <builders>
      <hudson.tasks.Shell>
        <command>
        # Run my shell command...
        </command>
      </hudson.tasks.Shell>
    </builders>