jenkinsapi
jenkinsapi copied to clipboard
How to get changes between 2 builds
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
Build object has method which returns a dictionary of changes.
@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.