forked from envoyproxy/envoy
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: Add github workflow for verify examples
Signed-off-by: Ryan Northey <ryan@synca.io>
- Loading branch information
Showing
15 changed files
with
310 additions
and
46 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
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,87 @@ | ||
name: Verify/examples | ||
|
||
on: | ||
# This runs untrusted code, do not expose secrets in the verify job | ||
workflow_dispatch: | ||
inputs: | ||
ref: | ||
description: "Git SHA ref to checkout" | ||
sha: | ||
description: "Git SHA of commit HEAD (ie last commit of PR)" | ||
head_ref: | ||
description: "Ref for grouping PRs" | ||
|
||
concurrency: | ||
group: ${{ github.event.inputs.head_ref || github.run_id }}-${{ github.workflow }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
check: | ||
if: | | ||
${{ | ||
github.repository == 'phlax/envoy' | ||
&& (!contains(github.actor, '[bot]') | ||
|| github.actor == trigger-workflow-verify-examples[bot]) | ||
}} | ||
uses: ./.github/workflows/workflow-start.yml | ||
permissions: | ||
contents: read | ||
statuses: write | ||
with: | ||
workflowName: ${{ github.workflow }} | ||
|
||
# Runs untrusted code | ||
verify-examples: | ||
runs-on: ubuntu-20.04 | ||
needs: check | ||
steps: | ||
# Checkout the repo at provided commit | ||
- name: 'Checkout Repository' | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: "${{ inputs.ref }}" | ||
|
||
- run: | | ||
set -e | ||
BUCKET="envoy-pr" | ||
if [[ "${{ github.actor }}" == "envoy-cibot" ]]; then | ||
BUCKET="envoy-postsubmit" | ||
fi | ||
DOWNLOAD_PATH="$(echo "${{ github.event.inputs.sha }}" | head -c 7)" | ||
tmpdir=$(mktemp -d) | ||
cd "$tmpdir" | ||
images=("" "contrib" "google-vrp") | ||
for image in "${images[@]}"; do | ||
if [[ -n "$image" ]]; then | ||
variant="${image}-dev" | ||
filename="envoy-${image}.tar" | ||
else | ||
variant=dev | ||
filename="envoy.tar" | ||
fi | ||
fileurl="https://storage.googleapis.com/${BUCKET}/${DOWNLOAD_PATH}/docker/${filename}" | ||
echo "Download docker image (${fileurl}) ..." | ||
curl -sLO "$fileurl" | ||
echo "Copy oci image: oci-archive:${filename} docker-daemon:envoyproxy/envoy:${variant}" | ||
skopeo copy -q "oci-archive:${filename}" "docker-daemon:envoyproxy/envoy:${variant}" | ||
rm "$filename" | ||
done | ||
docker images | grep envoy | ||
- run: | | ||
set -e | ||
export DEBIAN_FRONTEND=noninteractive | ||
sudo apt-get -qq update -y | ||
sudo apt-get -qq install -y --no-install-recommends expect | ||
- run: | | ||
./ci/do_ci.sh verify_examples | ||
env: | ||
NO_BUILD_SETUP: 1 | ||
# ENVOY_EXAMPLES_DEBUG: 1 |
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,61 @@ | ||
name: Workflow complete | ||
# This workflow is only required for externally triggered jobs that have manually | ||
# set the check status for a commit/PR | ||
|
||
on: | ||
# Do not run untrusted code here | ||
workflow_run: | ||
workflows: | ||
- Verify/examples | ||
types: | ||
- completed | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
complete: | ||
runs-on: ubuntu-20.04 | ||
permissions: | ||
statuses: write | ||
steps: | ||
- name: 'Download artifact' | ||
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 == "state_sha" | ||
})[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(`${process.env.GITHUB_WORKSPACE}/state_sha.zip`, Buffer.from(download.data)); | ||
- run: | | ||
set -e | ||
unzip state_sha.zip | ||
STATE_SHA="$(cat state_sha)" | ||
echo "state_sha=$STATE_SHA" >> "$GITHUB_OUTPUT" | ||
STATE="${{ github.event.workflow_run.conclusion }}" | ||
if [[ ${STATE} != "success" ]]; then | ||
STATE=failure | ||
fi | ||
echo "state=${STATE}" >> "$GITHUB_OUTPUT" | ||
id: job | ||
- name: Complete status check | ||
uses: envoyproxy/toolshed/gh-actions/status@a6e1c951217efae1ac6b2bf32c5a9729976442b8 | ||
with: | ||
authToken: ${{ secrets.GITHUB_TOKEN }} | ||
context: ${{ github.event.workflow.name }} | ||
state: ${{ steps.job.outputs.state }} | ||
sha: ${{ steps.job.outputs.state_sha }} | ||
target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.event.workflow_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,38 @@ | ||
name: Workflow start | ||
# This workflow is only required for externally triggered jobs that need to manually | ||
# set the check status for a commit/PR | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
workflowName: | ||
required: true | ||
type: string | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
start: | ||
runs-on: ubuntu-20.04 | ||
permissions: | ||
statuses: write | ||
steps: | ||
- name: Start status check | ||
uses: envoyproxy/toolshed/gh-actions/status@a6e1c951217efae1ac6b2bf32c5a9729976442b8 | ||
with: | ||
authToken: ${{ secrets.GITHUB_TOKEN }} | ||
context: ${{ inputs.workflowName }} | ||
state: 'pending' | ||
sha: ${{ inputs.sha }} | ||
target_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} | ||
- name: Save the SHA | ||
env: | ||
STATE_SHA: ${{ inputs.sha }} | ||
run: | | ||
mkdir -p ./sha | ||
echo $STATE_SHA > ./sha/state_sha | ||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: state_sha | ||
path: sha/ |
Oops, something went wrong.