jenkinsapi icon indicating copy to clipboard operation
jenkinsapi copied to clipboard

How to get changes between 2 builds

Open bacms2 opened this issue 5 years ago • 2 comments

ISSUE TYPE
  • How to...
Jenkinsapi VERSION

2.190.3

Jenkins VERSION

2.190.3

SUMMARY

I am trying to get the changes between two builds through the API but I can't seem to find a way of doing this. See code below.

I want to get the information I can get on Jenkins by going to https://jenkins_server.com/job/ResDev/job/I2EDefaultResourceRelease/846/changes

#Authenticate to server 
jenkins_server = Jenkins(jenkins_url,username=username,password=user_token)
#Get the resource release project 
i2ed_rr = jenkins_server['ResDev/I2EDefaultResourceRelease']
#Get the changeset between the previous and current builds 
previous_build  = i2ed_rr.get_build(840)
current_build = i2ed_rr.get_build(846)
#TODO get changeset 

bacms2 avatar Jan 06 '20 17:01 bacms2

Build object has method which returns a dictionary of changes.

lechat avatar Jan 06 '20 17:01 lechat

@lechat, unfortunately, that is returning an empty dictionary.

After some investigation, this seems related to the expression if 'items' in self._data['changeSets'] returning False. The issue seems to be that self._data['changeSets'] is a list so although each item on that list contains the 'items' the function won't pick this.

bacms2 avatar Jan 07 '20 09:01 bacms2