Skip to content

Commit

Permalink
Merge pull request #50 from scality/bugfix/BERTE-569-set-pending-as-i…
Browse files Browse the repository at this point in the history
…n-progress

BERTE-569 change the way we take into account pending queued or completed builds
  • Loading branch information
tcarmet authored May 19, 2022
2 parents e90595e + e5ea987 commit b8f7366
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.


## [3.6.16] - 2022-05-19
# Fixed
- Take into account queued or pending status as inprogress.

## [3.6.14] - 2022-05-18
# Fixed
- Infinite loop when searching for workflow dispatch runs.
Expand Down
13 changes: 9 additions & 4 deletions bert_e/git_host/github/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,11 @@ def is_pending(self):
elem for elem in self._check_suites if elem['status'] == 'pending'
]) > 0

def is_queued(self):
return len([
elem for elem in self._check_suites if elem['status'] == 'queued'
]) > 0

def _get_aggregate_workflow_dispatched(self, page, prev_dispatches=list()):
"""Return a list of check-suite IDs for workflow_dispatch runs"""

Expand Down Expand Up @@ -603,17 +608,17 @@ def remove_unwanted_workflows(self):
def state(self):
self.remove_unwanted_workflows()
all_complete = all(
elem['status'] == 'completed' for elem in self._check_suites
elem['conclusion'] is not None for elem in self._check_suites
)
all_success = all(
elem['conclusion'] == 'success'
for elem in self._check_suites
)
if self._check_suites.__len__() == 0 or self.is_pending():
if self._check_suites.__len__() == 0:
return 'NOTSTARTED'
elif self._check_suites.__len__() > 0 and not all_complete:
elif self.is_pending() or self.is_queued() or not all_complete:
return 'INPROGRESS'
elif self._check_suites.__len__() > 0 and all_complete and all_success:
elif all_complete and all_success:
return 'SUCCESSFUL'
else:
return 'FAILED'
Expand Down

0 comments on commit b8f7366

Please sign in to comment.