|
| 1 | +name: V3 E2E |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + paths: &paths |
| 6 | + - .github/workflows/v3-e2e.yaml |
| 7 | + - api/** |
| 8 | + - cmd/** |
| 9 | + - dagger/** |
| 10 | + - e2e/kots-release-install-v3/** |
| 11 | + - e2e/licenses/ci-v3.yaml |
| 12 | + - kinds/** |
| 13 | + - local-artifact-mirror/** |
| 14 | + - operator/** |
| 15 | + - pkg/** |
| 16 | + - pkg-new/** |
| 17 | + - scripts/** |
| 18 | + - utils/** |
| 19 | + - web/** |
| 20 | + - common.mk |
| 21 | + - dagger.json |
| 22 | + - go.mod |
| 23 | + - go.sum |
| 24 | + - Makefile |
| 25 | + - versions.mk |
| 26 | + |
| 27 | + push: |
| 28 | + branches: |
| 29 | + - main |
| 30 | + paths: *paths |
| 31 | + |
| 32 | +concurrency: |
| 33 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 34 | + cancel-in-progress: true |
| 35 | + |
| 36 | +permissions: |
| 37 | + contents: write |
| 38 | + |
| 39 | +jobs: |
| 40 | + output-vars: |
| 41 | + name: Output variables |
| 42 | + runs-on: ubuntu-latest |
| 43 | + outputs: |
| 44 | + git_version: ${{ steps.output_vars.outputs.git_version }} |
| 45 | + k0s_minor_version: ${{ steps.output_vars.outputs.k0s_minor_version }} |
| 46 | + ec_version: ${{ steps.output_vars.outputs.ec_version }} |
| 47 | + app_version: ${{ steps.output_vars.outputs.app_version }} |
| 48 | + steps: |
| 49 | + - name: Checkout |
| 50 | + uses: actions/checkout@v6 |
| 51 | + with: |
| 52 | + fetch-depth: 0 # necessary for getting the last tag |
| 53 | + |
| 54 | + - name: Get git sha |
| 55 | + id: git_sha |
| 56 | + uses: ./.github/actions/git-sha |
| 57 | + |
| 58 | + - name: Output variables |
| 59 | + id: output_vars |
| 60 | + run: | |
| 61 | + GIT_VERSION=$(git describe --tags --abbrev=4 --match='[0-9]*.[0-9]*.[0-9]*') |
| 62 | + echo "GIT_VERSION=\"$GIT_VERSION\"" |
| 63 | + echo "git_version=$GIT_VERSION" >> $GITHUB_OUTPUT |
| 64 | +
|
| 65 | + K0S_MINOR_VERSION=$(make print-K0S_MINOR_VERSION) |
| 66 | + echo "K0S_MINOR_VERSION=\"$K0S_MINOR_VERSION\"" |
| 67 | + echo "k0s_minor_version=$K0S_MINOR_VERSION" >> $GITHUB_OUTPUT |
| 68 | +
|
| 69 | + EC_VERSION="$(./scripts/print-ec-version.sh "$GIT_VERSION" "$K0S_MINOR_VERSION")-v3" |
| 70 | + echo "EC_VERSION=\"$EC_VERSION\"" |
| 71 | + echo "ec_version=$EC_VERSION" >> $GITHUB_OUTPUT |
| 72 | +
|
| 73 | + APP_VERSION="appver-dev-v3-${{ steps.git_sha.outputs.git_sha }}" |
| 74 | + echo "APP_VERSION=\"$APP_VERSION\"" |
| 75 | + echo "app_version=$APP_VERSION" >> $GITHUB_OUTPUT |
| 76 | +
|
| 77 | + build-release: |
| 78 | + name: Build release |
| 79 | + needs: |
| 80 | + - output-vars |
| 81 | + runs-on: ubuntu-latest |
| 82 | + steps: |
| 83 | + - name: Checkout |
| 84 | + uses: actions/checkout@v6 |
| 85 | + |
| 86 | + - name: Cache embedded bins |
| 87 | + uses: actions/cache@v4 |
| 88 | + with: |
| 89 | + path: | |
| 90 | + output/bins |
| 91 | + key: bins-cache-${{ hashFiles('Makefile', 'versions.mk') }} |
| 92 | + restore-keys: | |
| 93 | + bins-cache- |
| 94 | +
|
| 95 | + - name: Setup go |
| 96 | + uses: actions/setup-go@v6 |
| 97 | + with: |
| 98 | + go-version-file: go.mod |
| 99 | + cache-dependency-path: "**/*.sum" |
| 100 | + |
| 101 | + - name: Setup node |
| 102 | + uses: actions/setup-node@v6 |
| 103 | + with: |
| 104 | + node-version-file: ./web/.nvmrc |
| 105 | + |
| 106 | + - name: Setup oras |
| 107 | + uses: oras-project/setup-oras@v1 |
| 108 | + |
| 109 | + - name: Setup crane |
| 110 | + uses: imjasonh/setup-crane@v0.4 |
| 111 | + |
| 112 | + - name: Setup dagger |
| 113 | + run: | |
| 114 | + curl -fsSL https://dl.dagger.io/dagger/install.sh | sh |
| 115 | + sudo mv ./bin/dagger /usr/local/bin/dagger |
| 116 | +
|
| 117 | + - name: Setup replicated cli |
| 118 | + env: |
| 119 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 120 | + run: | |
| 121 | + gh release download --repo replicatedhq/replicated --pattern '*linux_amd64.tar.gz' --output replicated.tar.gz |
| 122 | + tar xf replicated.tar.gz replicated && rm replicated.tar.gz |
| 123 | + mv replicated /usr/local/bin/replicated |
| 124 | +
|
| 125 | + - name: Free up runner disk space # this is much faster than .github/actions/free-disk-space |
| 126 | + run: | |
| 127 | + df -h |
| 128 | + sudo rm -rf \ |
| 129 | + /usr/share/swift \ |
| 130 | + /usr/share/dotnet \ |
| 131 | + /usr/lib/jvm \ |
| 132 | + /usr/local/share/boost \ |
| 133 | + /usr/local/lib/heroku \ |
| 134 | + /usr/local/julia* \ |
| 135 | + /usr/local/.ghcup \ |
| 136 | + /usr/local/share/powershell \ |
| 137 | + /usr/local/bin/aliyun \ |
| 138 | + /usr/local/bin/azcopy \ |
| 139 | + /usr/local/bin/bicep \ |
| 140 | + /usr/local/bin/cpack \ |
| 141 | + /usr/local/bin/hub \ |
| 142 | + /usr/local/bin/minikube \ |
| 143 | + /usr/local/bin/packer \ |
| 144 | + /usr/local/bin/pulumi* \ |
| 145 | + /usr/local/bin/sam \ |
| 146 | + /usr/local/bin/stack \ |
| 147 | + /usr/local/bin/terraform \ |
| 148 | + /usr/local/bin/oc |
| 149 | + df -h |
| 150 | +
|
| 151 | + - name: Build release |
| 152 | + env: |
| 153 | + K0S_MINOR_VERSION: "${{ needs.output-vars.outputs.k0s_minor_version }}" |
| 154 | + VERSION: "${{ needs.output-vars.outputs.git_version }}" |
| 155 | + EC_VERSION: ${{ needs.output-vars.outputs.ec_version }} |
| 156 | + APP_VERSION: ${{ needs.output-vars.outputs.app_version }} |
| 157 | + APP_CHANNEL: CI-V3 |
| 158 | + APP_CHANNEL_ID: 36LoGcOOLvEPFXQXCUsFub28Abi |
| 159 | + APP_CHANNEL_SLUG: ci-v3 |
| 160 | + AWS_ACCESS_KEY_ID: ${{ secrets.STAGING_EMBEDDED_CLUSTER_UPLOAD_IAM_KEY_ID }} |
| 161 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.STAGING_EMBEDDED_CLUSTER_UPLOAD_IAM_SECRET }} |
| 162 | + AWS_REGION: "us-east-1" |
| 163 | + S3_BUCKET: tf-staging-embedded-cluster-bin |
| 164 | + REPLICATED_API_TOKEN: ${{ secrets.STAGING_REPLICATED_API_TOKEN }} |
| 165 | + USE_CHAINGUARD: "1" |
| 166 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 167 | + run: | |
| 168 | + make e2e-v3-initial-release |
| 169 | +
|
| 170 | + e2e-headless-online: |
| 171 | + name: E2E headless online |
| 172 | + needs: |
| 173 | + - output-vars |
| 174 | + - build-release |
| 175 | + runs-on: ubuntu-latest |
| 176 | + steps: |
| 177 | + - name: Checkout |
| 178 | + uses: actions/checkout@v6 |
| 179 | + |
| 180 | + - name: Setup dagger |
| 181 | + run: | |
| 182 | + curl -fsSL https://dl.dagger.io/dagger/install.sh | sh |
| 183 | + sudo mv ./bin/dagger /usr/local/bin/dagger |
| 184 | +
|
| 185 | + - name: Run test |
| 186 | + id: test |
| 187 | + env: |
| 188 | + APP_VERSION: ${{ needs.output-vars.outputs.app_version }} |
| 189 | + KUBE_VERSION: "1.${{ needs.output-vars.outputs.k0s_minor_version }}" |
| 190 | + CMX_REPLICATED_API_TOKEN: ${{ secrets.CMX_REPLICATED_API_TOKEN }} |
| 191 | + CMX_SSH_PRIVATE_KEY: ${{ secrets.CMX_SSH_PRIVATE_KEY }} |
| 192 | + run: | |
| 193 | + # Run test and export results directory |
| 194 | + dagger call e-2-e-run-headless \ |
| 195 | + --scenario=online \ |
| 196 | + --app-version=$APP_VERSION \ |
| 197 | + --kube-version=$KUBE_VERSION \ |
| 198 | + --license-file ./e2e/licenses/ci-v3.yaml \ |
| 199 | + --cmx-token=env://CMX_REPLICATED_API_TOKEN \ |
| 200 | + --ssh-key=env://CMX_SSH_PRIVATE_KEY \ |
| 201 | + export --path=./e2e-results |
| 202 | +
|
| 203 | + # Read result.json to extract test result |
| 204 | + if [ -f ./e2e-results/result.json ]; then |
| 205 | + success=$(jq -r '.Success' ./e2e-results/result.json) |
| 206 | + echo "Test success: $success" |
| 207 | +
|
| 208 | + # Exit with test result |
| 209 | + if [ "$success" = "true" ]; then |
| 210 | + exit 0 |
| 211 | + else |
| 212 | + error=$(jq -r '.Error' ./e2e-results/result.json) |
| 213 | + echo "::error::E2E test failed: $error" |
| 214 | + exit 1 |
| 215 | + fi |
| 216 | + else |
| 217 | + echo "::error::result.json not found in e2e-results directory" |
| 218 | + exit 1 |
| 219 | + fi |
| 220 | +
|
| 221 | + - name: Upload test results |
| 222 | + if: ${{ !cancelled() && hashFiles('./e2e-results/**') != '' }} |
| 223 | + uses: actions/upload-artifact@v4 |
| 224 | + with: |
| 225 | + name: e2e-results-headless-online |
| 226 | + path: ./e2e-results/ |
0 commit comments