Skip to content

Commit

Permalink
Merge branch '8.13' into updatecli_8.13_updatecli-beats-8.13
Browse files Browse the repository at this point in the history
  • Loading branch information
oren-zohar authored Apr 10, 2024
2 parents 4c93121 + 6d7ac0f commit bed4000
Showing 1 changed file with 31 additions and 14 deletions.
45 changes: 31 additions & 14 deletions .github/workflows/rerun-flaky-workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,34 @@ 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 ${{ 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 }}"
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 }}"
- 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=${{ github.event.workflow_run.run_attempt }}
CURRENT_RUN=${{ env.WORKFLOW_RUN_ATTEMPT }}
if [ $CURRENT_RUN -lt $MAX_RUNS ]; then
gh run rerun ${{ github.event.workflow_run.id }} --repo ${{ github.repository }} --failed
gh run rerun ${{ env.WORKFLOW_RUN_ID }} --repo ${{ env.GITHUB_REPOSITORY }} --failed
else
exit 1
fi
Expand All @@ -40,33 +52,38 @@ 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 ${{ github.event.workflow_run.head_sha }})
commit_short=$(git rev-parse --short ${{ env.WORKFLOW_RUN_HEAD_SHA }})
echo "BREAKING_COMMIT_SHORT=$commit_short" >> $GITHUB_ENV
- name: Slack Notification
uses: ./.github/actions/slack-notification
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
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 ${{ github.event.workflow.name }} is failing on ${{ github.event.workflow_run.head_branch }} :alert:",
"text": ":alert: CI ${{ env.WORKFLOW_NAME }} is failing on ${{ env.WORKFLOW_HEAD_BRANCH }} :alert:",
"blocks": [
{
"type": "header",
"text": {
"type": "plain_text",
"text": ":alert: CI ${{ github.event.workflow.name }} is failing on ${{ github.event.workflow_run.head_branch }} :alert:",
"text": ":alert: CI ${{ env.WORKFLOW_NAME }} is failing on ${{ env.WORKFLOW_HEAD_BRANCH }} :alert:",
"emoji": true
}
}
Expand All @@ -79,7 +96,7 @@ jobs:
"type": "section",
"text": {
"type": "mrkdwn",
"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."
"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."
}
},
{
Expand Down

0 comments on commit bed4000

Please sign in to comment.