|
| 1 | +# Copyright 2026 Google LLC |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | + |
| 15 | +# Upgrades a cluster running a release to this checkout, with actors on it, |
| 16 | +# following docs/guides/upgrade.md, and checks that every actor survives (see |
| 17 | +# internal/e2e/upgrade). Two installs on one kind cluster take too long for |
| 18 | +# every PR, so this runs for every push to a release branch, before a patch |
| 19 | +# release is tagged from it, plus on demand for any branch. |
| 20 | +name: upgrade-e2e |
| 21 | +on: |
| 22 | + push: |
| 23 | + branches: ['release-[0-9]+.[0-9]+'] |
| 24 | + workflow_dispatch: |
| 25 | + inputs: |
| 26 | + from: |
| 27 | + description: 'Tag or commit to upgrade from. Required except on a release branch, which defaults to its newest earlier release' |
| 28 | + required: false |
| 29 | + default: '' |
| 30 | +permissions: |
| 31 | + contents: read |
| 32 | +jobs: |
| 33 | + upgrade: |
| 34 | + name: Upgrade e2e (${{ matrix.sandbox }}) |
| 35 | + runs-on: ubuntu-latest |
| 36 | + timeout-minutes: 120 |
| 37 | + strategy: |
| 38 | + fail-fast: false |
| 39 | + matrix: |
| 40 | + sandbox: [gvisor, microvm] |
| 41 | + env: |
| 42 | + # Points the suite at the counter-microvm fixture. Empty means gVisor. |
| 43 | + E2E_SANDBOX_CLASS: ${{ matrix.sandbox == 'microvm' && 'microvm' || '' }} |
| 44 | + # Where the previous release's ate-setup writes its install record. |
| 45 | + ATE_RECORD_DIR: ${{ github.workspace }}/ate-records |
| 46 | + # deploy ate-system requires a credential provider selection. The |
| 47 | + # record keeps it for the upgrade. |
| 48 | + ATE_CREDENTIAL_PROVIDER: '{"name":"k8s.io"}' |
| 49 | + # deploy ate-system also requires an ingress allowlist. This is the |
| 50 | + # suite's router client (internal/e2e/ingressauth.go). |
| 51 | + ATE_INGRESS_ALLOWED_SPIFFE_IDS: spiffe://cluster.local/ns/ate-e2e-router-client/sa/router-client |
| 52 | + ARTIFACTS: ${{ github.workspace }}/_artifacts |
| 53 | + steps: |
| 54 | + - name: Checkout the release under test |
| 55 | + uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0 |
| 56 | + with: |
| 57 | + path: new |
| 58 | + # Full history brings the release tags the next step picks from. |
| 59 | + fetch-depth: 0 |
| 60 | + - name: Pick the release to upgrade from |
| 61 | + id: from |
| 62 | + working-directory: new |
| 63 | + env: |
| 64 | + FROM: ${{ inputs.from }} |
| 65 | + TO: ${{ github.ref_name }} |
| 66 | + EVENT: ${{ github.event_name }} |
| 67 | + run: .github/scripts/upgrade-e2e/pick-from.sh |
| 68 | + - name: Checkout ${{ steps.from.outputs.tag }} |
| 69 | + if: steps.from.outputs.tag != '' |
| 70 | + uses: actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09 # v5.1.0 |
| 71 | + with: |
| 72 | + ref: ${{ steps.from.outputs.tag }} |
| 73 | + path: old |
| 74 | + - name: Setup Go |
| 75 | + if: steps.from.outputs.tag != '' |
| 76 | + uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 |
| 77 | + with: |
| 78 | + go-version-file: new/go.mod |
| 79 | + cache-dependency-path: | |
| 80 | + new/go.sum |
| 81 | + old/go.sum |
| 82 | + - name: Enable KVM |
| 83 | + if: steps.from.outputs.tag != '' && matrix.sandbox == 'microvm' |
| 84 | + run: new/.github/scripts/upgrade-e2e/enable-kvm.sh |
| 85 | + - name: Create cluster |
| 86 | + if: steps.from.outputs.tag != '' |
| 87 | + working-directory: new |
| 88 | + run: hack/create-kind-cluster.sh |
| 89 | + - name: Install ${{ steps.from.outputs.tag }} |
| 90 | + if: steps.from.outputs.tag != '' |
| 91 | + working-directory: old |
| 92 | + run: ../new/.github/scripts/upgrade-e2e/install-old.sh ${{ matrix.sandbox }} |
| 93 | + - name: Upgrade to ${{ github.ref_name }} |
| 94 | + if: steps.from.outputs.tag != '' |
| 95 | + # The suite performs the upgrade with this checkout's ate-setup, in the |
| 96 | + # runbook's order and from a copy of the install record, and checks the |
| 97 | + # actors after every step. |
| 98 | + working-directory: new |
| 99 | + env: |
| 100 | + E2E_ATE_SETUP_CONFIG: ${{ github.workspace }}/new.yaml |
| 101 | + E2E_JUNIT_FILE: ${{ github.workspace }}/_artifacts/e2e-upgrade-${{ matrix.sandbox }}.xml |
| 102 | + run: .github/scripts/upgrade-e2e/run-suite.sh |
| 103 | + # A suite that stops matching would otherwise leave the run green and empty. |
| 104 | + - name: Require the suite to have run tests |
| 105 | + if: always() && steps.from.outputs.tag != '' |
| 106 | + working-directory: new |
| 107 | + run: go -C tools/junittool run . verify -manifest "${ARTIFACTS}/expected-junit.txt" |
| 108 | + - name: Upload test results |
| 109 | + if: always() && steps.from.outputs.tag != '' |
| 110 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 |
| 111 | + with: |
| 112 | + name: test-results-upgrade-e2e-${{ matrix.sandbox }} |
| 113 | + # The install records carry no secrets. |
| 114 | + path: | |
| 115 | + ${{ env.ARTIFACTS }} |
| 116 | + ${{ env.ATE_RECORD_DIR }} |
| 117 | + if-no-files-found: error |
| 118 | + - name: Dump diagnostics on failure |
| 119 | + if: failure() && steps.from.outputs.tag != '' |
| 120 | + run: new/.github/scripts/upgrade-e2e/dump-diagnostics.sh |
0 commit comments