Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: return changeset items correctly from a pipeline build #850

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions jenkinsapi/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,11 @@ def get_changeset_items(self):
if "items" in self._data["changeSet"]:
return self._data["changeSet"]["items"]
elif "changeSets" in self._data:
if "items" in self._data["changeSets"]:
return self._data["changeSets"]["items"]
changes = []
for change in self._data["changeSets"]:
if "items" in change:
changes += change["items"]
return changes
return []

def _get_vcs(self) -> str:
Expand Down
47 changes: 26 additions & 21 deletions jenkinsapi_tests/unittests/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,27 +168,32 @@
"artifacts": [],
"building": False,
"builtOn": "localhost",
"changeSets": {
"items": [
{
"affectedPaths": ["content/rcm/v00-rcm-xccdf.xml"],
"author": {
"absoluteUrl": "http://jenkins_url/user/username79",
"fullName": "username",
},
"commitId": "3097",
"timestamp": 1414398423091,
"date": "2014-10-27T08:27:03.091288Z",
"msg": "commit message",
"paths": [
{"editType": "edit", "file": "/some/path/of/changed_file"}
],
"revision": 3097,
"user": "username",
}
],
"kind": None,
},
"changeSets": [
{
"items": [
{
"affectedPaths": ["content/rcm/v00-rcm-xccdf.xml"],
"author": {
"absoluteUrl": "http://jenkins_url/user/username79",
"fullName": "username",
},
"commitId": "3097",
"timestamp": 1414398423091,
"date": "2014-10-27T08:27:03.091288Z",
"msg": "commit message",
"paths": [
{
"editType": "edit",
"file": "/some/path/of/changed_file",
}
],
"revision": 3097,
"user": "username",
}
],
"kind": None,
}
],
"culprits": [],
"description": "Best build ever!",
"duration": 5782,
Expand Down
Loading