Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test new workflows #17

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/actions/commit-status/end/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CommitStatusEnd
description: 'Adds a commit status at the end of the test run based on success, failure, or cancelled'
inputs:
name:
description: "Name of the check"
required: true
git_ref:
description: "The git commit, tag, or branch to check out. Requires a corresponding Karpenter snapshot release"
required: true
runs:
using: "composite"
steps:
- uses: actions/github-script@v6
if: job.status == 'success'
with:
script: |
github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
context: "${{ inputs.name }}",
sha: "${{ inputs.git_ref }}",
state: "success",
target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
});
- uses: actions/github-script@v6
if: job.status == 'failure' || job.status == 'cancelled'
with:
script: |
github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
context: "${{ inputs.name }}",
sha: "${{ inputs.git_ref }}",
state: "failure",
target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
});
24 changes: 24 additions & 0 deletions .github/actions/commit-status/start/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: CommitStatusStart
description: 'Adds a commit status at the start of the test run to set the status to pending'
inputs:
name:
description: "Name of the check"
required: true
git_ref:
description: "The git commit, tag, or branch to check out"
required: true
runs:
using: "composite"
steps:
- uses: actions/github-script@v6
if: always()
with:
script: |
github.rest.repos.createCommitStatus({
owner: context.repo.owner,
repo: context.repo.repo,
context: "${{ inputs.name }}",
sha: "${{ inputs.git_ref }}",
state: "pending",
target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
});
15 changes: 13 additions & 2 deletions .github/workflows/approval-comment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ jobs:
if: startsWith(github.event.review.body, '/e2e')
runs-on: ubuntu-latest
steps:
- name: run e2e
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Save info about the review comment as an artifact for other workflows that run on workflow_run to download them
env:
REVIEW_BODY: ${{ github.event.review.body }}
run: |
echo "run e2e"
mkdir -p /tmp/artifacts
{ echo ${{ github.event.pull_request.number }}; echo ${{ github.event.review.commit_id }}; } >> /tmp/artifacts/metadata.txt
cat /tmp/artifacts/metadata.txt
- uses: actions/upload-artifact@v3
with:
name: artifacts
path: /tmp/artifacts
14 changes: 10 additions & 4 deletions .github/workflows/e2e-matrix-trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,22 @@ on:
workflow_dispatch:
push:
branches: [main]
pull_request_review: # TODO(charliedmcb): come back to this and factor out the E2E trigger like AWS and clean it up
types: [submitted]
workflow_run:
workflows: [ApprovalComment]
types: [completed]
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
statuses: write # ./.github/actions/commit-status/*
jobs:
resolve:
uses: ./.github/workflows/resolve-args.yaml
e2e-matrix:
if: github.event_name != 'pull_request_review' || startsWith(github.event.review.body ,'/test')
needs: [resolve]
uses: ./.github/workflows/e2e-matrix.yaml
with:
git_ref: ${{ needs.resolve.outputs.GIT_REF }}
secrets:
E2E_CLIENT_ID: ${{ secrets.E2E_CLIENT_ID }}
E2E_TENANT_ID: ${{ secrets.E2E_TENANT_ID }}
E2E_SUBSCRIPTION_ID: ${{ secrets.E2E_SUBSCRIPTION_ID }}
E2E_SUBSCRIPTION_ID: ${{ secrets.E2E_SUBSCRIPTION_ID }}
5 changes: 4 additions & 1 deletion .github/workflows/e2e-matrix.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
name: E2EMatrix
on:
workflow_call:
# inputs:
inputs:
git_ref:
type: string
# region:
# type: string
# default: "us-east-2"
Expand Down Expand Up @@ -34,6 +36,7 @@ jobs:
suite: [Nonbehavioral, Utilization, GPU, Drift, Integration]
uses: ./.github/workflows/e2e.yaml
with:
git_ref: ${{ inputs.git_ref }}
suite: ${{ matrix.suite }}
hash: ${{ needs.initialize-generative-params.outputs.E2E_HASH }}
# region: ${{ inputs.region }}
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ on:
# region:
# type: string
# default: "us-east-2"
git_ref:
type: string
suite:
type: string
required: true
Expand All @@ -24,6 +26,7 @@ on:
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
statuses: write # ./.github/actions/commit-status/*
jobs:
run-suite:
name: suite-${{ inputs.suite }}
Expand All @@ -32,6 +35,11 @@ jobs:
AZURE_SUBSCRIPTION_ID: ${{ secrets.E2E_SUBSCRIPTION_ID }}
steps:
- uses: actions/checkout@v3
- if: always() && github.event_name == 'workflow_run'
uses: ./.github/actions/commit-status/start
with:
name: ${{ github.workflow }} / e2e (${{ inputs.suite }})
git_ref: ${{ inputs.git_ref }}
- uses: ./.github/actions/install-deps
- name: az login
uses: azure/login@v1
Expand Down Expand Up @@ -120,3 +128,8 @@ jobs:
resource_group: ${{ env.RG_NAME }}
cluster_name: ${{ env.CLUSTER_NAME }}
acr_name: ${{ env.ACR_NAME }}
- if: always() && github.event_name == 'workflow_run'
uses: ./.github/actions/commit-status/end
with:
name: ${{ github.workflow }} / e2e (${{ inputs.suite }})
git_ref: ${{ inputs.git_ref }}
23 changes: 23 additions & 0 deletions .github/workflows/resolve-args.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: ResolveArgs
on:
workflow_call:
outputs:
GIT_REF:
value: ${{ jobs.resolve.outputs.GIT_REF }}
jobs:
resolve:
runs-on: ubuntu-latest
outputs:
GIT_REF: ${{ steps.resolve-step.outputs.GIT_REF }}
steps:
# Download the artifact and resolve the GIT_REF
- uses: actions/checkout@v4
- if: github.event_name == 'workflow_run'
uses: ./.github/actions/download-artifact
- id: resolve-step
run: |
if [[ "${{ github.event_name }}" == "workflow_run" ]]; then
echo GIT_REF="$(tail -n 1 /tmp/artifacts/metadata.txt)" >> "$GITHUB_OUTPUT"
else
echo GIT_REF="" >> "$GITHUB_OUTPUT"
fi