@@ -211,3 +211,168 @@ jobs:
211211 files : |
212212 build/*.tgz
213213 build/metadata.json
214+
215+ build-previous-stable :
216+ name : Build previous stable
217+ runs-on : embedded-cluster
218+ needs :
219+ - get-tag
220+ outputs :
221+ ec_version : ${{ steps.export.outputs.ec_version }}
222+ k0s_version : ${{ steps.export.outputs.k0s_version }}
223+ steps :
224+ - name : Checkout
225+ uses : actions/checkout@v4
226+ - name : Export k0s version
227+ id : export
228+ env :
229+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
230+ run : |
231+ k0s_majmin_version="$(make print-PREVIOUS_K0S_VERSION | sed 's/v\([0-9]*\.[0-9]*\).*/\1/')"
232+ EC_VERSION="$(gh release list --repo replicatedhq/embedded-cluster \
233+ --exclude-drafts --exclude-pre-releases --json name \
234+ --jq '.[] | .name' \
235+ | grep "k8s-${k0s_majmin_version}" \
236+ | head -n1)"
237+
238+ gh release download "$EC_VERSION" --repo replicatedhq/embedded-cluster --pattern 'metadata.json'
239+ K0S_VERSION="$(jq -r '.Versions.Kubernetes' metadata.json)"
240+
241+ echo "EC_VERSION=\"$EC_VERSION\""
242+ echo "K0S_VERSION=\"$K0S_VERSION\""
243+ echo "ec_version=$EC_VERSION" >> "$GITHUB_OUTPUT"
244+ echo "k0s_version=$K0S_VERSION" >> "$GITHUB_OUTPUT"
245+
246+ release-app :
247+ name : Create app releases
248+ runs-on : ubuntu-latest
249+ permissions :
250+ pull-requests : write
251+ needs :
252+ - release
253+ - get-tag
254+ - build-previous-stable
255+ steps :
256+ - name : Checkout
257+ uses : actions/checkout@v4
258+ with :
259+ fetch-depth : 0
260+ - name : Install replicated CLI
261+ env :
262+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
263+ run : |
264+ gh release download --repo replicatedhq/replicated --pattern '*linux_amd64.tar.gz' --output replicated.tar.gz
265+ tar xf replicated.tar.gz replicated && rm replicated.tar.gz
266+ mv replicated /usr/local/bin/replicated
267+ - name : Create CI releases
268+ env :
269+ REPLICATED_APP : " embedded-cluster-smoke-test-staging-app"
270+ REPLICATED_API_TOKEN : ${{ secrets.STAGING_REPLICATED_API_TOKEN }}
271+ REPLICATED_API_ORIGIN : " https://api.staging.replicated.com/vendor"
272+ APP_CHANNEL : CI
273+ USES_DEV_BUCKET : " 0"
274+ run : |
275+ # install the current k0s version
276+ export EC_VERSION="${{ needs.get-tag.outputs.tag-name }}"
277+ export APP_VERSION="appver-${{ needs.get-tag.outputs.tag-name }}"
278+ export RELEASE_YAML_DIR=e2e/kots-release-install
279+ ./scripts/ci-release-app.sh
280+ # and finally an app upgrade
281+ export EC_VERSION="${{ needs.get-tag.outputs.tag-name }}-upgrade"
282+ export APP_VERSION="appver-${{ needs.get-tag.outputs.tag-name }}-upgrade"
283+ export RELEASE_YAML_DIR=e2e/kots-release-upgrade
284+ ./scripts/ci-release-app.sh
285+ - name : Create airgap releases
286+ env :
287+ REPLICATED_APP : " embedded-cluster-smoke-test-staging-app"
288+ REPLICATED_API_TOKEN : ${{ secrets.STAGING_REPLICATED_API_TOKEN }}
289+ REPLICATED_API_ORIGIN : " https://api.staging.replicated.com/vendor"
290+ APP_CHANNEL : CI-airgap
291+ USES_DEV_BUCKET : " 0"
292+ run : |
293+ # re-promote a release containing an old version of embedded-cluster to test upgrades
294+ export APP_VERSION="appver-${{ needs.get-tag.outputs.tag-name }}-1.8.0-k8s-1.28"
295+ replicated release promote 11615 2cHXb1RCttzpR0xvnNWyaZCgDBP --version "${APP_VERSION}"
296+ replicated release promote 11615 2eAqMYG1IEtX8cwpaO1kgNV6EB3 --version "${APP_VERSION}"
297+
298+ # promote a release containing the previous stable version of embedded-cluster to test upgrades
299+ export EC_VERSION="${{ needs.build-previous-stable.outputs.ec_version }}"
300+ export APP_VERSION="appver-${{ needs.get-tag.outputs.tag-name }}-previous-stable"
301+ export RELEASE_YAML_DIR=e2e/kots-release-install-stable
302+ ./scripts/ci-release-app.sh
303+ # promote a release with the current k0s version, but call it the previous version to test noop upgrades
304+ export EC_VERSION="${{ needs.get-tag.outputs.tag-name }}"
305+ export APP_VERSION="appver-${{ needs.get-tag.outputs.tag-name }}-previous-k0s"
306+ export RELEASE_YAML_DIR=e2e/kots-release-install
307+ ./scripts/ci-release-app.sh
308+ # promote a release with the current k0s version
309+ export EC_VERSION="${{ needs.get-tag.outputs.tag-name }}"
310+ export APP_VERSION="appver-${{ needs.get-tag.outputs.tag-name }}"
311+ export RELEASE_YAML_DIR=e2e/kots-release-install
312+ ./scripts/ci-release-app.sh
313+ # and finally an app upgrade
314+ export EC_VERSION="${{ needs.get-tag.outputs.tag-name }}"
315+ export APP_VERSION="appver-${{ needs.get-tag.outputs.tag-name }}-upgrade"
316+ export RELEASE_YAML_DIR=e2e/kots-release-upgrade
317+ ./scripts/ci-release-app.sh
318+ e2e :
319+ name : E2E
320+ runs-on : ${{ matrix.runner || 'ubuntu-22.04' }}
321+ needs :
322+ - release
323+ - release-app
324+ - get-tag
325+ - build-previous-stable
326+ strategy :
327+ fail-fast : false
328+ matrix :
329+ test :
330+ - TestResetAndReinstallAirgap
331+ - TestSingleNodeAirgapUpgrade
332+ include :
333+ - test : TestMultiNodeAirgapUpgrade
334+ runner : embedded-cluster
335+ - test : TestAirgapUpgradeFromEC18
336+ runner : embedded-cluster
337+ - test : TestMultiNodeAirgapUpgradePreviousStable
338+ runner : embedded-cluster
339+ steps :
340+ - name : Checkout
341+ uses : actions/checkout@v4
342+
343+ - uses : ./.github/actions/e2e
344+ with :
345+ test-name : ' ${{ matrix.test }}'
346+ is-large-runner : ${{ matrix.runner == 'embedded-cluster' }}
347+ airgap-license-id : ${{ secrets.STAGING_EMBEDDED_CLUSTER_AIRGAP_LICENSE_ID }}
348+ snapshot-license-id : ${{ secrets.STAGING_EMBEDDED_CLUSTER_SNAPSHOT_LICENSE_ID }}
349+ snapshot-license : ${{ secrets.STAGING_EMBEDDED_CLUSTER_SNAPSHOT_LICENSE }}
350+ airgap-snapshot-license-id : ${{ secrets.STAGING_EMBEDDED_CLUSTER_AIRGAP_SNAPSHOT_LICENSE_ID }}
351+ license-id : ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE_ID }}
352+ license : ${{ secrets.STAGING_EMBEDDED_CLUSTER_LICENSE }}
353+ dr-aws-access-key-id : ${{ secrets.TESTIM_AWS_ACCESS_KEY_ID }}
354+ dr-aws-secret-access-key : ${{ secrets.TESTIM_AWS_SECRET_ACCESS_KEY }}
355+ version-specifier : ${{ needs.get-tag.outputs.tag-name }}
356+
357+ k0s-version : ${{ needs.get-tag.outputs.k0s_version }}
358+ k0s-version-previous : ${{ needs.get-tag.outputs.k0s_version }} # we do not run k8s upgrade tests on release
359+ k0s-version-previous-stable : ${{ needs.build-previous-stable.outputs.k0s_version }}
360+ upgrade-target-ec-version : ${{ needs.get-tag.outputs.tag-name }}
361+
362+ # this job will validate that all the tests passed
363+ # it is used for the github branch protection rule
364+ validate-release-success :
365+ name : Validate success
366+ runs-on : ubuntu-20.04
367+ needs :
368+ - e2e
369+ - release
370+ - release-app
371+ if : always()
372+ steps :
373+ # https://docs.github.com/en/actions/learn-github-actions/contexts#needs-context
374+ - name : fail if e2e job was not successful
375+ if : needs.e2e.result != 'success'
376+ run : exit 1
377+ - name : succeed if everything else passed
378+ run : echo "Validation succeeded"
0 commit comments