Skip to content

Commit 1aaaf3b

Browse files
authored
chore(ci): upgrade from previous stable for our e2e tests (#3067)
* chore(ci): upgrade from previous stable for our e2e tests * chore(ci): build an older previous release to test out upgrades * fix(ci): correct initial k8s version assertion
1 parent 5266fd0 commit 1aaaf3b

File tree

2 files changed

+31
-29
lines changed

2 files changed

+31
-29
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ name: CI
33
on:
44
pull_request:
55
paths-ignore:
6-
- '.claude/**'
6+
- ".claude/**"
77

88
push:
99
branches:
1010
- main
1111
paths-ignore:
12-
- '.claude/**'
12+
- ".claude/**"
1313

1414
concurrency:
1515
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
@@ -556,17 +556,13 @@ jobs:
556556
env:
557557
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
558558
run: |
559+
previous_release_gap="5" # How many versions behind of EC we want to use
559560
k0s_minor_version=$(make print-K0S_MINOR_VERSION)
560561
previous_k0s_minor_version=$(($k0s_minor_version - 1))
561562
k0s_majmin_version="1.${previous_k0s_minor_version}"
562-
if [ "$k0s_majmin_version" == "1.28" ]; then
563-
k0s_majmin_version="1.29"
564-
fi
565563
EC_VERSION="$(gh release list --repo replicatedhq/embedded-cluster \
566-
--exclude-drafts --exclude-pre-releases --json name \
567-
--jq '.[] | .name' \
568-
| grep "k8s-${k0s_majmin_version}" \
569-
| head -n1)"
564+
--exclude-drafts --exclude-pre-releases --json name --order desc \
565+
--jq "[.[] | select(.name | contains(\"k8s-${k0s_majmin_version}\"))] | .[${previous_release_gap}] | .name")"
570566
571567
gh release download "$EC_VERSION" --repo replicatedhq/embedded-cluster --pattern 'metadata.json'
572568
K0S_VERSION="$(jq -r '.Versions.Kubernetes' metadata.json)"
@@ -738,7 +734,7 @@ jobs:
738734
run: |
739735
export SHORT_SHA=dev-${{ needs.output-vars.outputs.git_sha }}
740736
741-
# promote a release containing the previous stable version of embedded-cluster to test upgrades
737+
# promote a release containing a previous stable version of embedded-cluster to test upgrades
742738
export EC_VERSION="${{ needs.find-previous-stable.outputs.ec_version }}"
743739
export APP_VERSION="appver-${SHORT_SHA}-previous-stable"
744740
export RELEASE_YAML_DIR=e2e/kots-release-install-stable

e2e/install_test.go

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ func TestSingleNodeUpgradePreviousStable(t *testing.T) {
418418
})
419419
defer tc.Cleanup()
420420

421+
// Previous stable EC version with a -1 minor k0s version
421422
initialVersion := fmt.Sprintf("appver-%s-previous-stable", os.Getenv("SHORT_SHA"))
422423

423424
downloadECReleaseWithOptions(t, tc, 0, downloadECReleaseOptions{
@@ -480,7 +481,8 @@ func TestUpgradeFromReplicatedApp(t *testing.T) {
480481
})
481482
defer tc.Cleanup()
482483

483-
initialVersion := fmt.Sprintf("appver-%s-previous-k0s-1", os.Getenv("SHORT_SHA"))
484+
// Previous stable EC version with a -1 minor k0s version
485+
initialVersion := fmt.Sprintf("appver-%s-previous-stable", os.Getenv("SHORT_SHA"))
484486

485487
downloadECReleaseWithOptions(t, tc, 0, downloadECReleaseOptions{
486488
version: initialVersion,
@@ -496,7 +498,7 @@ func TestUpgradeFromReplicatedApp(t *testing.T) {
496498

497499
checkInstallationStateWithOptions(t, tc, installationStateOptions{
498500
version: initialVersion,
499-
k8sVersion: k8sVersionPrevious(1),
501+
k8sVersion: k8sVersionPreviousStable(),
500502
})
501503

502504
appUpgradeVersion := fmt.Sprintf("appver-%s-upgrade", os.Getenv("SHORT_SHA"))
@@ -704,7 +706,8 @@ func TestSingleNodeAirgapUpgrade(t *testing.T) {
704706
defer tc.Cleanup()
705707

706708
t.Logf("%s: downloading airgap files on node 0", time.Now().Format(time.RFC3339))
707-
initialVersion := fmt.Sprintf("appver-%s-previous-k0s-1", os.Getenv("SHORT_SHA"))
709+
// Previous stable EC version with a -1 minor k0s version
710+
initialVersion := fmt.Sprintf("appver-%s-previous-stable", os.Getenv("SHORT_SHA"))
708711
runInParallel(t,
709712
func(t *testing.T) error {
710713
return downloadAirgapBundleOnNode(t, tc, 0, initialVersion, AirgapInstallBundlePath, AirgapLicenseID)
@@ -735,7 +738,7 @@ func TestSingleNodeAirgapUpgrade(t *testing.T) {
735738
}
736739

737740
t.Logf("%s: checking installation state after app deployment", time.Now().Format(time.RFC3339))
738-
line = []string{"check-airgap-installation-state.sh", initialVersion, k8sVersionPrevious(1)}
741+
line = []string{"check-airgap-installation-state.sh", initialVersion, k8sVersionPreviousStable()}
739742
if _, _, err := tc.RunCommandOnNode(0, line); err != nil {
740743
t.Fatalf("fail to check installation state: %v", err)
741744
}
@@ -775,7 +778,8 @@ func TestSingleNodeAirgapUpgradeSelinux(t *testing.T) {
775778
defer tc.Cleanup()
776779

777780
t.Logf("%s: downloading airgap files on node 0", time.Now().Format(time.RFC3339))
778-
initialVersion := fmt.Sprintf("appver-%s-previous-k0s-1", os.Getenv("SHORT_SHA"))
781+
// Previous stable EC version with a -1 minor k0s version
782+
initialVersion := fmt.Sprintf("appver-%s-previous-stable", os.Getenv("SHORT_SHA"))
779783
runInParallel(t,
780784
func(t *testing.T) error {
781785
return downloadAirgapBundleOnNode(t, tc, 0, initialVersion, AirgapInstallBundlePath, AirgapLicenseID)
@@ -821,7 +825,7 @@ func TestSingleNodeAirgapUpgradeSelinux(t *testing.T) {
821825
}
822826

823827
t.Logf("%s: checking installation state after app deployment", time.Now().Format(time.RFC3339))
824-
line = []string{"/usr/local/bin/check-airgap-installation-state.sh", initialVersion, k8sVersionPrevious(1)}
828+
line = []string{"/usr/local/bin/check-airgap-installation-state.sh", initialVersion, k8sVersionPreviousStable()}
825829
if _, _, err := tc.RunCommandOnNode(0, line); err != nil {
826830
t.Fatalf("fail to check installation state: %v", err)
827831
}
@@ -861,7 +865,8 @@ func TestSingleNodeAirgapUpgradeCustomCIDR(t *testing.T) {
861865
defer tc.Cleanup()
862866

863867
t.Logf("%s: downloading airgap files on node 0", time.Now().Format(time.RFC3339))
864-
initialVersion := fmt.Sprintf("appver-%s-previous-k0s-1", os.Getenv("SHORT_SHA"))
868+
// Previous stable EC version with a -1 minor k0s version
869+
initialVersion := fmt.Sprintf("appver-%s-previous-stable", os.Getenv("SHORT_SHA"))
865870
runInParallel(t,
866871
func(t *testing.T) error {
867872
return downloadAirgapBundleOnNode(t, tc, 0, initialVersion, AirgapInstallBundlePath, AirgapLicenseID)
@@ -892,7 +897,7 @@ func TestSingleNodeAirgapUpgradeCustomCIDR(t *testing.T) {
892897
}
893898

894899
t.Logf("%s: checking installation state after app deployment", time.Now().Format(time.RFC3339))
895-
line = []string{"check-airgap-installation-state.sh", initialVersion, k8sVersionPrevious(1)}
900+
line = []string{"check-airgap-installation-state.sh", initialVersion, k8sVersionPreviousStable()}
896901
if _, _, err := tc.RunCommandOnNode(0, line); err != nil {
897902
t.Fatalf("fail to check installation state: %v", err)
898903
}
@@ -1233,7 +1238,8 @@ func TestMultiNodeAirgapUpgrade(t *testing.T) {
12331238
defer tc.Cleanup()
12341239

12351240
t.Logf("%s: downloading airgap files", time.Now().Format(time.RFC3339))
1236-
initialVersion := fmt.Sprintf("appver-%s-previous-k0s-1", os.Getenv("SHORT_SHA"))
1241+
// Previous stable EC version with a -1 minor k0s version
1242+
initialVersion := fmt.Sprintf("appver-%s-previous-stable", os.Getenv("SHORT_SHA"))
12371243
upgradeVersion := fmt.Sprintf("appver-%s-upgrade", os.Getenv("SHORT_SHA"))
12381244
runInParallel(t,
12391245
func(t *testing.T) error {
@@ -1272,7 +1278,7 @@ func TestMultiNodeAirgapUpgrade(t *testing.T) {
12721278
waitForNodes(t, tc, 2, nil)
12731279

12741280
t.Logf("%s: checking installation state after app deployment", time.Now().Format(time.RFC3339))
1275-
line = []string{"check-airgap-installation-state.sh", initialVersion, k8sVersionPrevious(1)}
1281+
line = []string{"check-airgap-installation-state.sh", initialVersion, k8sVersionPreviousStable()}
12761282
if stdout, stderr, err := tc.RunCommandOnNode(0, line); err != nil {
12771283
t.Fatalf("fail to check installation state: %v: %s: %s", err, stdout, stderr)
12781284
}
@@ -1375,16 +1381,15 @@ func TestMultiNodeAirgapUpgradePreviousStable(t *testing.T) {
13751381
t.Fatalf("fail to run airgap update: %v: %s: %s", err, stdout, stderr)
13761382
}
13771383

1378-
appUpgradeVersion := fmt.Sprintf("appver-%s-noop", os.Getenv("SHORT_SHA"))
1379-
testArgs := []string{appUpgradeVersion}
1384+
testArgs := []string{upgradeVersion}
13801385

13811386
t.Logf("%s: upgrading cluster", time.Now().Format(time.RFC3339))
13821387
if stdout, stderr, err := tc.RunPlaywrightTest("deploy-upgrade", testArgs...); err != nil {
13831388
t.Fatalf("fail to run playwright test deploy-upgrade: %v: %s: %s", err, stdout, stderr)
13841389
}
13851390

13861391
t.Logf("%s: checking installation state after noop upgrade", time.Now().Format(time.RFC3339))
1387-
line = []string{"check-airgap-installation-state.sh", appUpgradeVersion, k8sVersion()}
1392+
line = []string{"check-airgap-installation-state.sh", upgradeVersion, k8sVersion()}
13881393
if stdout, stderr, err := tc.RunCommandOnNode(0, line, withEnv); err != nil {
13891394
t.Fatalf("fail to check installation state: %v: %s: %s", err, stdout, stderr)
13901395
}
@@ -1395,8 +1400,7 @@ func TestMultiNodeAirgapUpgradePreviousStable(t *testing.T) {
13951400
t.Fatalf("fail to run airgap update: %v: %s: %s", err, stdout, stderr)
13961401
}
13971402

1398-
appUpgradeVersion = fmt.Sprintf("appver-%s-upgrade", os.Getenv("SHORT_SHA"))
1399-
testArgs = []string{appUpgradeVersion}
1403+
testArgs = []string{upgrade2Version}
14001404

14011405
t.Logf("%s: upgrading cluster a second time", time.Now().Format(time.RFC3339))
14021406
if stdout, stderr, err := tc.RunPlaywrightTest("deploy-upgrade", testArgs...); err != nil {
@@ -1774,7 +1778,8 @@ func TestFiveNodesAirgapUpgrade(t *testing.T) {
17741778
defer tc.Cleanup()
17751779

17761780
t.Logf("%s: downloading airgap files", time.Now().Format(time.RFC3339))
1777-
initialVersion := fmt.Sprintf("appver-%s-previous-k0s-1", os.Getenv("SHORT_SHA"))
1781+
// Previous stable EC version with a -1 minor k0s version
1782+
initialVersion := fmt.Sprintf("appver-%s-previous-stable", os.Getenv("SHORT_SHA"))
17781783
upgradeVersion := fmt.Sprintf("appver-%s-upgrade", os.Getenv("SHORT_SHA"))
17791784
runInParallel(t,
17801785
func(t *testing.T) error {
@@ -1863,7 +1868,7 @@ func TestFiveNodesAirgapUpgrade(t *testing.T) {
18631868
waitForNodes(t, tc, 5, nil)
18641869

18651870
t.Logf("%s: checking installation state after app deployment", time.Now().Format(time.RFC3339))
1866-
line = []string{"check-airgap-installation-state.sh", initialVersion, k8sVersionPrevious(1)}
1871+
line = []string{"check-airgap-installation-state.sh", initialVersion, k8sVersionPreviousStable()}
18671872
if stdout, stderr, err := tc.RunCommandOnNode(0, line); err != nil {
18681873
t.Fatalf("fail to check installation state: %v: %s: %s", err, stdout, stderr)
18691874
}
@@ -1975,7 +1980,8 @@ func TestSingleNodeAirgapUpgradeConfigValues(t *testing.T) {
19751980
defer tc.Cleanup()
19761981

19771982
t.Logf("%s: downloading airgap files on node 0", time.Now().Format(time.RFC3339))
1978-
initialVersion := fmt.Sprintf("appver-%s-previous-k0s-1", os.Getenv("SHORT_SHA"))
1983+
// Previous stable EC version with a -1 minor k0s version
1984+
initialVersion := fmt.Sprintf("appver-%s-previous-stable", os.Getenv("SHORT_SHA"))
19791985
runInParallel(t,
19801986
func(t *testing.T) error {
19811987
return downloadAirgapBundleOnNode(t, tc, 0, initialVersion, AirgapInstallBundlePath, AirgapLicenseID)
@@ -2025,7 +2031,7 @@ spec:
20252031
})
20262032

20272033
t.Logf("%s: checking installation state after app deployment", time.Now().Format(time.RFC3339))
2028-
line = []string{"check-airgap-installation-state.sh", initialVersion, k8sVersionPrevious(1)}
2034+
line = []string{"check-airgap-installation-state.sh", initialVersion, k8sVersionPreviousStable()}
20292035
if _, _, err := tc.RunCommandOnNode(0, line); err != nil {
20302036
t.Fatalf("fail to check installation state: %v", err)
20312037
}

0 commit comments

Comments
 (0)