Skip to content

Commit

Permalink
ci: Improve /retest (envoyproxy#27458)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Northey <[email protected]>
  • Loading branch information
phlax authored May 18, 2023
1 parent 58335ef commit 3696ca5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/commands.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
name: commands

on:
issue_comment:
types: [created]

permissions:
contents: read

jobs:
retest:
if: |
Expand All @@ -13,8 +17,10 @@ jobs:
&& github.actor != 'dependabot[bot]'
}}
name: Retest
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
pull-requests: write
steps:
- uses: jpsim/retest@c158dec0a7f67cb85f8367468dc8a9a75308bb7f
- uses: envoyproxy/toolshed/gh-actions/retest@56d5781416445ed530e075b71546dedee94cf054
with:
token: ${{ secrets.GITHUB_TOKEN }}
21 changes: 9 additions & 12 deletions ci/repokitteh/modules/azure_pipelines.star
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ def _get_azp_link(check_id):
return "https://dev.azure.com/{organization}/{project}/_build/results?buildId={buildId}&view=results".format(organization = _azp_organization, project = project, buildId = build_id)

def _retry(config, comment_id, command):
msgs = "Retrying Azure Pipelines:\n"
if len(command.parts) > 1 and command.parts[1] == "mobile":
return
check_ids, checks = _get_azp_checks()

retried_checks = []
reaction = "confused"
for check_id in check_ids:
subchecks = [c for c in checks if c["external_id"] == check_id]
if len(subchecks) == 0:
Expand All @@ -50,20 +52,15 @@ def _retry(config, comment_id, command):
if check["status"] == "in_progress":
has_running = True

if not has_failure:
msgs += "Check {} didn't fail.\n".format(name_with_link)
else:
if has_running:
msgs += "Check {} isn't fully completed, but will still attempt retrying.\n".format(name_with_link)
if has_failure:
_, build_id, project = check_id.split("|")
_retry_azp(project, build_id, config["token"])
retried_checks.append(name_with_link)

if len(retried_checks) == 0:
react(comment_id, msgs)
else:
react(comment_id, None)
msgs += "Retried failed jobs in: {}".format(", ".join(retried_checks))
github.issue_create_comment(msgs)
if len(retried_checks) != 0:
reaction = "+1"

github.issue_create_comment_reaction(comment_id, reaction)


handlers.command(name = "retry-azp", func = _retry)

0 comments on commit 3696ca5

Please sign in to comment.