-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(e2e): improving the E2E flow to make E2E references not get remo…
…ved on approval (#18) * update trigger in mainline * update workflows * Revert "update trigger in mainline" This reverts commit e1e0d9c. * add download artifact action * switch back to test to make sure it aligns with old approval comment * add new lines --------- Co-authored-by: Charlie McBride <[email protected]>
- Loading branch information
1 parent
19d06fd
commit 1b6b0a7
Showing
8 changed files
with
155 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}", | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }}", | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: DownloadArtifacts | ||
description: 'Downloads and unarchives artifacts for a workflow that runs on workflow_run so that it can use its data' | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
run_id: context.payload.workflow_run.id, | ||
}); | ||
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => { | ||
return artifact.name == "artifacts" | ||
})[0]; | ||
let download = await github.rest.actions.downloadArtifact({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
artifact_id: matchArtifact.id, | ||
archive_format: 'zip', | ||
}); | ||
let fs = require('fs'); | ||
fs.writeFileSync(`/tmp/artifacts.zip`, Buffer.from(download.data)); | ||
- run: | | ||
mkdir -p /tmp/artifacts | ||
unzip /tmp/artifacts.zip -d /tmp/artifacts | ||
shell: bash | ||
- run: | | ||
echo "Downloaded artifacts:" | ||
ls -ablh /tmp/artifacts | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |