ci(.github): enable self hosted runners for AMD64 E2E tasks (#10945) #6
Workflow file for this run
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
on: | ||
workflow_call: | ||
inputs: | ||
matrix: | ||
required: true | ||
type: string | ||
runner: | ||
type: string | ||
<<<<<<< HEAD:.github/workflows/e2e.yaml | ||
required: false | ||
default: '{"amd64": "ubuntu-latest", "arm64": "ubuntu-latest-arm64-kong"}' | ||
======= | ||
required: true | ||
>>>>>>> 126029d11 (ci(.github): enable self hosted runners for AMD64 E2E tasks (#10945)):.github/workflows/_e2e.yaml | ||
permissions: | ||
contents: read | ||
env: | ||
CI_TOOLS_DIR: ${{ contains(inputs.runner, '-kong') && '/work/kuma/kuma/.ci_tools' || '/home/runner/work/kuma/kuma/.ci_tools' }} | ||
E2E_PARAM_K8S_VERSION: ${{ fromJSON(inputs.matrix).k8sVersion }} | ||
E2E_PARAM_CNI_NETWORK_PLUGIN: ${{ fromJSON(inputs.matrix).cniNetworkPlugin }} | ||
E2E_PARAM_ARCH: ${{ fromJSON(inputs.matrix).arch }} | ||
E2E_PARAM_LEGACY_KDS: ${{ fromJSON(inputs.matrix).legacyKDS }} | ||
E2E_PARAM_TARGET: ${{ fromJSON(inputs.matrix).target }} | ||
E2E_PARAM_PARALLELISM: ${{ fromJSON(inputs.matrix).parallelism }} | ||
jobs: | ||
e2e: | ||
<<<<<<< HEAD:.github/workflows/e2e.yaml | ||
runs-on: ${{ fromJSON(inputs.runnersByArch)[fromJSON(inputs.matrix).arch] }} | ||
if: ${{ fromJSON(inputs.runnersByArch)[fromJSON(inputs.matrix).arch] != '' }} | ||
======= | ||
timeout-minutes: 60 | ||
# can't use env vars here | ||
runs-on: ${{ inputs.runner }} | ||
if: ${{ inputs.runner != '' }} | ||
>>>>>>> 126029d11 (ci(.github): enable self hosted runners for AMD64 E2E tasks (#10945)):.github/workflows/_e2e.yaml | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
parallelRunnerId: ${{ fromJSON((fromJSON(inputs.matrix).parallelism == '3' && '[0, 1, 2]') || '[0]') }} | ||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | ||
with: | ||
fetch-depth: 0 | ||
- uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2 | ||
with: | ||
go-version-file: go.mod | ||
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | ||
with: | ||
path: | | ||
${{ env.CI_TOOLS_DIR }} | ||
key: ${{ runner.os }}-${{ runner.arch }}-devtools-${{ hashFiles('mk/dependencies/deps.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-${{ runner.arch }}-devtools | ||
- run: | | ||
make dev/tools | ||
- name: "Free up disk space for the Runner" | ||
run: | | ||
echo "Disk usage before cleanup" | ||
sudo df -h | ||
echo "Removing big directories" | ||
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc | ||
echo "Pruning images" | ||
docker system prune --all -f | ||
echo "Disk usage after cleanup" | ||
sudo df -h | ||
- run: | | ||
make build | ||
- run: | | ||
make -j build/distributions | ||
- uses: nick-fields/retry@v3 | ||
id: retry | ||
with: | ||
max_attempts: 3 | ||
retry_wait_seconds: 15s | ||
timeout_minutes: 30 | ||
command: make -j images && make -j docker/save | ||
- run: | | ||
make dev/set-kuma-helm-repo | ||
- name: "Enable ipv6 for docker" | ||
if: ${{ env.E2E_PARAM_K8S_VERSION == 'kindIpv6' }} | ||
run: | | ||
cat <<'EOF' | sudo tee /etc/docker/daemon.json | ||
{ | ||
"ipv6": true, | ||
"fixed-cidr-v6": "2001:db8:1::/64", | ||
"dns-search": ["."] | ||
} | ||
EOF | ||
sudo service docker restart | ||
- name: "Run E2E tests" | ||
env: | ||
DOCKERHUB_PULL_CREDENTIAL: ${{ secrets.DOCKERHUB_PULL_CREDENTIAL }} | ||
run: | | ||
if [[ "${{ env.E2E_PARAM_K8S_VERSION }}" == "kindIpv6" ]]; then | ||
export IPV6=true | ||
export K8S_CLUSTER_TOOL=kind | ||
export KUMA_DEFAULT_RETRIES=60 | ||
export KUMA_DEFAULT_TIMEOUT="6s" | ||
fi | ||
if [[ "${{ env.E2E_PARAM_K8S_VERSION }}" != "kind"* ]]; then | ||
export CI_K3S_VERSION=$E2E_PARAM_K8S_VERSION | ||
export K3D_NETWORK_CNI=${{ env.E2E_PARAM_CNI_NETWORK_PLUGIN }} | ||
fi | ||
if [[ "${{ env.E2E_PARAM_ARCH }}" == "arm64" ]]; then | ||
export MAKE_PARAMETERS="-j1" | ||
else | ||
export MAKE_PARAMETERS="-j2" | ||
fi | ||
if [[ "${{ env.E2E_PARAM_LEGACY_KDS }}" == "true" ]]; then | ||
export KUMA_LEGACY_KDS=true | ||
fi | ||
if [[ "${{ env.E2E_PARAM_TARGET }}" == "" ]]; then | ||
export GINKGO_E2E_LABEL_FILTERS="job-${{ matrix.parallelRunnerId }}" | ||
fi | ||
env | ||
<<<<<<< HEAD:.github/workflows/e2e.yaml | ||
======= | ||
if [[ "${{ env.E2E_PARAM_TARGET }}" == "multizone" ]]; then | ||
export KUMA_DEFAULT_RETRIES=60 | ||
fi | ||
function on_exit() | ||
{ | ||
docker logout docker.io | ||
} | ||
# we pull a few images during the E2E run, sometimes we get rate-limited by docker hub | ||
# to prevent this, we support specifying a pull credential here | ||
if [[ "$DOCKERHUB_PULL_CREDENTIAL" != "" ]]; then | ||
DOCKER_USER=$(echo "$DOCKERHUB_PULL_CREDENTIAL" | cut -d ':' -f 1) | ||
DOCKER_PWD=$(echo "$DOCKERHUB_PULL_CREDENTIAL" | cut -d ':' -f 2) | ||
echo -n "$DOCKER_PWD" | docker login -u "$DOCKER_USER" --password-stdin | ||
trap "on_exit" EXIT | ||
fi | ||
>>>>>>> 126029d11 (ci(.github): enable self hosted runners for AMD64 E2E tasks (#10945)):.github/workflows/_e2e.yaml | ||
if [[ "${{ env.E2E_PARAM_TARGET }}" != "" ]]; then | ||
target="test/e2e-${{ env.E2E_PARAM_TARGET }}" | ||
else | ||
target="test/e2e" | ||
fi | ||
make ${MAKE_PARAMETERS} CI=true "${target}" |