Skip to content

Commit

Permalink
Revert "[8.13](backport #2089) Update rerun workflow (#2107)"
Browse files Browse the repository at this point in the history
This reverts commit 3611691.
  • Loading branch information
gurevichdmitry authored Apr 9, 2024
1 parent 3611691 commit 03be36f
Showing 1 changed file with 13 additions and 34 deletions.
47 changes: 13 additions & 34 deletions .github/workflows/rerun-flaky-workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,22 @@ jobs:
actions: write
steps:
- name: Display Workflow Run Information
env:
WORKFLOW_RUN_ID: ${{ github.event.workflow_run.id }}
WORKFLOW_RUN_NAME: ${{ github.event.workflow_run.name }}
WORKFLOW_RUN_ATTEMPT: ${{ github.event.workflow_run.run_attempt }}
WORKFLOW_RUN_HTML_URL: ${{ github.event.workflow_run.html_url }}
GITHUB_JOB: ${{ github.job }}
GITHUB_RUN_ATTEMPT: ${{ github.run_attempt }}
AUTHOR_NAME: ${{ github.event.workflow_run.head_commit.author.name }}
GITHUB_ACTOR: ${{ github.actor }}
run: |
echo "The Workflow Run ${{ env.WORKFLOW_RUN_NAME }} has failed! " >> $GITHUB_STEP_SUMMARY
echo "View the failed run attempt (#${{ env.WORKFLOW_RUN_ATTEMPT }}) here: ${{ env.WORKFLOW_RUN_HTML_URL }}" >> $GITHUB_STEP_SUMMARY
echo "Workflow Run ID: ${{ env.WORKFLOW_RUN_ID }}"
echo "Job ID: ${{ env.GITHUB_JOB }}"
echo "Current run: ${{ env.GITHUB_RUN_ATTEMPT }}"
echo "Author: ${{ env.AUTHOR_NAME }}"
echo "Actor: ${{ env.GITHUB_ACTOR }}"
echo "The Workflow Run ${{ github.event.workflow_run.name }} has failed! " >> $GITHUB_STEP_SUMMARY
echo "View the failed run attempt (#${{ github.event.workflow_run.run_attempt }}) here: ${{ github.event.workflow_run.html_url }}" >> $GITHUB_STEP_SUMMARY
echo "Workflow Run ID: ${{ github.event.workflow_run.id }}"
echo "Job ID: ${{ github.job }}"
echo "Current run: ${{ github.run_attempt }}"
echo "Author: ${{ github.event.workflow_run.head_commit.author.name }}"
echo "Actor: ${{ github.actor }}"
- name: Rerun failed jobs in the current workflow
env:
GH_TOKEN: ${{ github.token }}
WORKFLOW_RUN_ATTEMPT: ${{ github.event.workflow_run.run_attempt }}
WORKFLOW_RUN_ID: ${{ github.event.workflow_run.id }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
MAX_RUNS=2
CURRENT_RUN=${{ env.WORKFLOW_RUN_ATTEMPT }}
CURRENT_RUN=${{ github.event.workflow_run.run_attempt }}
if [ $CURRENT_RUN -lt $MAX_RUNS ]; then
gh run rerun ${{ env.WORKFLOW_RUN_ID }} --repo ${{ env.GITHUB_REPOSITORY }} --failed
gh run rerun ${{ github.event.workflow_run.id }} --repo ${{ github.repository }} --failed
else
exit 1
fi
Expand All @@ -52,42 +40,33 @@ jobs:

- name: Update env vars
if: ${{ !cancelled() && failure() }} # Run only if the previous step failed
env:
WORKFLOW_RUN_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
run: |
commit_short=$(git rev-parse --short ${{ env.WORKFLOW_RUN_HEAD_SHA }})
commit_short=$(git rev-parse --short ${{ github.event.workflow_run.head_sha }})
echo "BREAKING_COMMIT_SHORT=$commit_short" >> $GITHUB_ENV
- name: Slack Notification
uses: ./.github/actions/slack-notification
<<<<<<< HEAD
if: ${{ !cancelled() && failure() }} # Run only if the previous step failed
=======
if: ${{ !cancelled() && failure() && github.event.workflow_run.head_branch == 'main'}} # Run only if the previous step failed
>>>>>>> 61b21ecb (Update rerun workflow (#2089))
continue-on-error: true
env:
BREAKING_COMMIT: "${{ github.event.workflow_run.head_sha }}"
RUN_URL: "${{ github.event.workflow_run.html_url }}"
RUN_NAME: "${{ github.event.workflow_run.name }}"
BRANCH: "${{ github.event.workflow_run.head_branch }}"
REPO: "${{ github.repository }}"
WORKFLOW_NAME: "${{ github.event.workflow.name }}"
WORKFLOW_HEAD_BRANCH: "${{ github.event.workflow_run.head_branch }}"
GITHUB_ACTOR: "${{ github.actor }}"
with:
vault-url: ${{ secrets.VAULT_ADDR }}
vault-role-id: ${{ secrets.CSP_VAULT_ROLE_ID }}
vault-secret-id: ${{ secrets.CSP_VAULT_SECRET_ID }}
slack-payload: |
{
"text": ":alert: CI ${{ env.WORKFLOW_NAME }} is failing on ${{ env.WORKFLOW_HEAD_BRANCH }} :alert:",
"text": ":alert: CI ${{ github.event.workflow.name }} is failing on ${{ github.event.workflow_run.head_branch }} :alert:",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":alert: CI ${{ env.WORKFLOW_NAME }} is failing on ${{ env.WORKFLOW_HEAD_BRANCH }} :alert:",
"text": ":alert: CI ${{ github.event.workflow.name }} is failing on ${{ github.event.workflow_run.head_branch }} :alert:",
"emoji": true
}
}
Expand All @@ -100,7 +79,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Commit <https://github.com/elastic/cloudbeat/commit/${{env.BREAKING_COMMIT}}|${{env.BREAKING_COMMIT_SHORT}}> by ${{env.GITHUB_ACTOR}} has failing tests on the `${{env.BRANCH}}` branch."
"text": "Commit <https://github.com/elastic/cloudbeat/commit/${{env.BREAKING_COMMIT}}|${{env.BREAKING_COMMIT_SHORT}}> by ${{github.actor}} has failing tests on the `${{env.BRANCH}}` branch."
}
},
{
Expand Down

0 comments on commit 03be36f

Please sign in to comment.