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

ci(.github): enable self hosted runners for AMD64 E2E tasks (backport of #10745) #10753

Closed
wants to merge 1 commit into from
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
7 changes: 5 additions & 2 deletions .github/workflows/_e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ on:
runnersByArch:
type: string
required: false
<<<<<<< HEAD
default: '{"amd64": "ubuntu-latest", "arm64": "circleci"}'
=======
default: ''
>>>>>>> 9fbead7e2 (ci(.github): enable self hosted runners for AMD64 E2E tasks (#10745))
permissions:
contents: read
env:
Expand All @@ -22,8 +26,7 @@ env:
jobs:
e2e:
timeout-minutes: 60
# use the runner from the map, if the runner is circleci or '' then use ubuntu-latest
runs-on: ${{ contains(fromJSON('["circleci", ""]'), fromJSON(inputs.runnersByArch)[fromJSON(inputs.matrix).arch]) && 'ubuntu-latest' || fromJSON(inputs.runnersByArch)[fromJSON(inputs.matrix).arch]}}
runs-on: ${{ fromJSON(inputs.runnersByArch)[fromJSON(inputs.matrix).arch] }}
strategy:
fail-fast: false
matrix:
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate-matrix.outputs.matrix }}
runners: ${{ steps.assign-e2e-runners.outputs.runners }}
steps:
- id: generate-matrix
name: Generate matrix
Expand Down Expand Up @@ -95,6 +96,48 @@ jobs:
echo "matrix<<EOF" >> $GITHUB_OUTPUT
echo "$BASE_MATRIX_ALL" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- id: assign-e2e-runners
name: Assign runners for E2E tests
env:
IS_TRUSTED_BUILD: ${{ github.event_name == 'push' || github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
ALL_RUNNERS: |-
{
"trusted_builds": {
"amd64": [
"ubuntu-latest-kong"
],
"arm64": [
"ubuntu-latest-arm64-kong"
]
},
"untrusted_builds": {
"amd64": [
"ubuntu-latest"
],
"arm64": []
}
}
run: |-
ALL_RUNNERS='${{ env.ALL_RUNNERS }}'
if [[ "${{ env.IS_TRUSTED_BUILD }}" == "true" ]]; then
ALL_RUNNERS=$(echo $ALL_RUNNERS | jq -r '.trusted_builds')
else
ALL_RUNNERS=$(echo $ALL_RUNNERS | jq -r '.untrusted_builds')
fi

for ARCH in amd64 arm64; do
COUNT=$(echo $ALL_RUNNERS | jq -r ".$ARCH | length")
if [[ $COUNT -eq 0 ]]; then
ALL_RUNNERS=$(echo $ALL_RUNNERS | jq -r ".$ARCH=\"\"")
else
ALL_RUNNERS=$(echo $ALL_RUNNERS | jq -r ".$ARCH=.$ARCH[0]")
fi
done

echo "final runners: $ALL_RUNNERS"
echo "runners<<EOF" >> $GITHUB_OUTPUT
echo "$ALL_RUNNERS" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
test_e2e:
needs: ["gen_e2e_matrix"]
if: fromJSON(needs.gen_e2e_matrix.outputs.matrix).test_e2e
Expand All @@ -105,6 +148,7 @@ jobs:
uses: ./.github/workflows/_e2e.yaml
with:
matrix: ${{ toJSON(matrix) }}
runnersByArch: ${{ needs.gen_e2e_matrix.outputs.runners }}
secrets: inherit
test_e2e_env:
needs: ["gen_e2e_matrix"]
Expand All @@ -116,4 +160,5 @@ jobs:
uses: ./.github/workflows/_e2e.yaml
with:
matrix: ${{ toJSON(matrix) }}
runnersByArch: ${{ needs.gen_e2e_matrix.outputs.runners }}
secrets: inherit