Skip to content

Commit

Permalink
fix: return changeset items correctly from a pipeline build
Browse files Browse the repository at this point in the history
Fixes pycontribs#748

Jenkins pipeline build returns a list of changesets instead of a
single changeset dict.
  • Loading branch information
kaltsi committed Dec 9, 2023
1 parent 4494278 commit 44048fa
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
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
4 changes: 2 additions & 2 deletions jenkinsapi_tests/unittests/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
"artifacts": [],
"building": False,
"builtOn": "localhost",
"changeSets": {
"changeSets": [{
"items": [
{
"affectedPaths": ["content/rcm/v00-rcm-xccdf.xml"],
Expand All @@ -188,7 +188,7 @@
}
],
"kind": None,
},
}],
"culprits": [],
"description": "Best build ever!",
"duration": 5782,
Expand Down

0 comments on commit 44048fa

Please sign in to comment.