Search code examples
jenkinsjenkins-cli

Get Recent Changes for Given Build Number in Jenkins using Jenkins CLI


I would like to get recent changes list from build number to build number for given job using command prompt.

For example, I have XYZ job created in Jenkins and latest builds are 101, 102, 103, 104. Using jenkins-cli.jar, I would like to execute a command where I can get list of recent changes made between 101 to 104. I am using SVN as repository.

Any Idea?


Solution

  • You can get a list of the commands supported by the Jenkins CLI by visiting http://jenkins:8080/cli.

    The Jenkins CLI provides the list-changes command:

    $ java -jar jenkins-cli.jar -s http://jenkins:8080/ help list-changes
    
    java -jar jenkins-cli.jar list-changes JOB RANGE [-format [XML | CSV | PLAIN]]
    Dumps the changelog for the specified build(s).
     JOB                         : Name of the job to build
     RANGE                       : Range of the build records to delete. 'N-M',
                                   'N,M', or 'N'
     -format [XML | CSV | PLAIN] : Controls how the output from this command is
                                   printed.
    

    "Range of the build records to delete" should read "Range of the build records to list changes for"

    For your example:

    $ java -jar jenkins-cli.jar -s http://jenkins:8080/ list-changes XYZ 101-104