Skip to content

Commit

Permalink
test: Specify PR number on a snapshot run (#4065)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis committed Jun 16, 2023
1 parent fca1649 commit bf484b6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
10 changes: 7 additions & 3 deletions .github/actions/e2e/slack/notify/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ inputs:
suite:
description: "Suite that's running"
required: true
pr_number:
description: "If specified, this run is associated with a PR and the slack message will reflect that"
url:
description: "Webhook URL to send the Slack notification to"
required: true
Expand All @@ -18,7 +20,9 @@ runs:
path: actions
- shell: bash
run: |
if [[ ${{ inputs.event_name }} == "schedule" ]]; then
if [[ ! -z "${{ inputs.pr_number }}" ]]; then
RUN_NAME="${{ inputs.suite }}-pr-${{ inputs.pr_number }}"
elif [[ ${{ inputs.event_name }} == "schedule" ]]; then
RUN_NAME="${{ inputs.suite }}-periodic"
else
RUN_NAME="${{ inputs.suite }}-${GITHUB_SHA::7}"
Expand All @@ -30,9 +34,9 @@ runs:
if: ${{ job.status == 'success' }}
with:
url: ${{ inputs.url }}
message: ":white_check_mark: ${{ env.RUN_NAME }} tests succeeded"
message: ":white_check_mark: ${{ env.RUN_NAME }} tests succeeded (#${{ github.run_number }})"
- uses: ./actions/.github/actions/e2e/slack/send-message
if: ${{ job.status == 'failure' }}
with:
url: ${{ inputs.url }}
message: ":x: ${{ env.RUN_NAME }} tests failed"
message: ":x: ${{ env.RUN_NAME }} tests failed (#${{ github.run_number }})"
11 changes: 8 additions & 3 deletions .github/workflows/e2e-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,21 @@ jobs:
if: (github.repository == 'aws/karpenter' && (github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success')) || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
outputs:
PR_NUM: ${{ steps.resolve-step.outputs.PR_NUM }}
GIT_REF: ${{ steps.resolve-step.outputs.GIT_REF }}
steps:
# Download the artifact and resolve the commit if initiated by PR snapshot
# Otherwise, use the currently checked-out branch to run the E2E tests against
- uses: actions/checkout@v3
- uses: ./.github/actions/download-artifact
if: github.event_name == 'workflow_run'
- if: github.event_name == 'workflow_run'
uses: ./.github/actions/download-artifact
- id: resolve-step
run: |
if [[ "${{ github.event_name }}" == "workflow_run" ]]; then
echo PR_NUM=$(head -n 1 /tmp/artifacts/metadata.txt) >> $GITHUB_OUTPUT
echo GIT_REF=$(tail -n 1 /tmp/artifacts/metadata.txt) >> $GITHUB_OUTPUT
else
echo PR_NUM="" >> $GITHUB_OUTPUT
echo GIT_REF="" >> $GITHUB_OUTPUT
fi
e2e:
Expand All @@ -43,6 +46,7 @@ jobs:
suite: ${{ matrix.suite }}
git_repo: aws/karpenter
git_ref: ${{ needs.resolve-git-ref.outputs.GIT_REF }}
pr_number: ${{ needs.resolve-git-ref.outputs.PR_NUM }}
event_name: ${{ github.event_name }}
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
Expand All @@ -51,9 +55,10 @@ jobs:
if: (github.repository == 'aws/karpenter' && (github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success')) || github.event_name == 'workflow_dispatch'
uses: ./.github/workflows/e2e-upgrade.yaml
with:
git_repo: aws/karpenter
from_git_ref: v0.26.1
to_git_ref: ${{ needs.resolve-git-ref.outputs.GIT_REF }}
git_repo: aws/karpenter
pr_number: ${{ needs.resolve-git-ref.outputs.PR_NUM }}
event_name: ${{ github.event_name }}
secrets:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
5 changes: 4 additions & 1 deletion .github/workflows/e2e-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ on:
required: true
to_git_ref:
type: string
pr_number:
type: string
event_name:
type: string
required: true
Expand Down Expand Up @@ -98,10 +100,11 @@ jobs:
TEST_SUITE="Integration" make e2etests
- name: notify slack of success or failure
uses: ./actions/.github/actions/e2e/slack/notify
if: ${{ (inputs.event_name == 'schedule' || inputs.event_name == 'push') && (success() || failure()) }}
if: success() || failure()
with:
url: ${{ secrets.SLACK_WEBHOOK_URL }}
suite: Upgrade
pr_number: ${{ inputs.pr_number }}
event_name: ${{ inputs.event_name }}
- name: dump logs on failure
uses: ./actions/.github/actions/e2e/dump-logs
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ on:
default: "aws/karpenter"
git_ref:
type: string
pr_number:
type: string
suite:
type: string
required: true
Expand Down Expand Up @@ -91,10 +93,11 @@ jobs:
TEST_SUITE="${{ inputs.suite }}" make e2etests
- name: notify slack of success or failure
uses: ./actions/.github/actions/e2e/slack/notify
if: ${{ success() || failure() }}
if: success() || failure()
with:
url: ${{ secrets.SLACK_WEBHOOK_URL }}
suite: ${{ inputs.suite }}
pr_number: ${{ inputs.pr_number }}
event_name: ${{ inputs.event_name }}
- name: dump logs on failure
uses: ./actions/.github/actions/e2e/dump-logs
Expand Down

0 comments on commit bf484b6

Please sign in to comment.