Skip to content

Commit 7418241

Browse files
committed
ci/cli: add support to test specific OS channel
Signed-off-by: Loic Devulder <ldevulder@suse.com>
1 parent 8d82119 commit 7418241

7 files changed

+74
-7
lines changed

.github/workflows/cli-obs-manual-workflow.yaml

+4-5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ on:
2727
description: Elemental operator repository to use
2828
default: oci://registry.opensuse.org/isv/rancher/elemental/dev/charts/rancher
2929
type: string
30+
os_channel:
31+
description: OS channel to test
32+
type: string
3033
os_to_test:
3134
description: OS repository to test (dev/staging/stable)
3235
type: string
@@ -38,10 +41,6 @@ on:
3841
description: Rancher Manager channel/version/head_version to use for installation
3942
default: stable/latest
4043
type: string
41-
sequential:
42-
description: Defines if bootstrapping is done sequentially (true) or in parallel (false)
43-
default: false
44-
type: boolean
4544

4645
jobs:
4746
cli:
@@ -57,9 +56,9 @@ jobs:
5756
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
5857
k8s_upstream_version: ${{ inputs.k8s_upstream_version }}
5958
operator_repo: ${{ inputs.operator_repo }}
59+
os_channel: ${{ inputs.os_channel }}
6060
os_to_test: ${{ inputs.os_to_test }}
6161
qase_run_id: ${{ inputs.qase_run_id }}
6262
rancher_version: ${{ inputs.rancher_version }}
6363
reset: true
64-
sequential: ${{ inputs.sequential }}
6564
test_type: cli

.github/workflows/master_e2e.yaml

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ on:
99
description: Version of backup-restore-operator to use
1010
type: string
1111
boot_type:
12-
description: Choose booting type (pxe, iso, raw)
13-
default: pxe
12+
description: Choose booting type (pxe, iso, raw)
13+
default: pxe
1414
type: string
1515
ca_type:
1616
description: CA type to use (selfsigned or private)
@@ -70,6 +70,9 @@ on:
7070
operator_upgrade:
7171
description: Elemental operator version to upgrade to
7272
type: string
73+
os_channel:
74+
description: Specific OS channel to test
75+
type: string
7376
os_to_test:
7477
description: OS repository to test (dev/staging/stable)
7578
type: string
@@ -242,6 +245,7 @@ jobs:
242245
operator_install_type: ${{ inputs.operator_install_type }}
243246
operator_repo: ${{ inputs.operator_repo }}
244247
operator_upgrade: ${{ inputs.operator_upgrade }}
248+
os_channel: ${{ inputs.os_channel }}
245249
os_to_test: ${{ inputs.os_to_test }}
246250
os_version_install: ${{ inputs.os_version_install }}
247251
os_version_target: ${{ inputs.os_version_target }}

.github/workflows/sub_cli.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ on:
5353
operator_upgrade:
5454
required: true
5555
type: string
56+
os_channel:
57+
required: true
58+
type: string
5659
os_to_test:
5760
required: true
5861
type: string
@@ -137,6 +140,7 @@ jobs:
137140
# For K8s cluster to provision with Rancher Manager
138141
K8S_DOWNSTREAM_VERSION: ${{ inputs.k8s_downstream_version }}
139142
OPERATOR_INSTALL_TYPE: ${{ inputs.operator_install_type }}
143+
OS_CHANNEL: ${{ inputs.os_channel }}
140144
OS_TO_TEST: ${{ inputs.os_to_test }}
141145
# For Rancher Manager
142146
RANCHER_VERSION: ${{ inputs.rancher_version }}

.github/workflows/sub_test_choice.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ on:
6262
operator_upgrade:
6363
required: true
6464
type: string
65+
os_channel:
66+
required: true
67+
type: string
6568
os_to_test:
6669
required: true
6770
type: string
@@ -183,6 +186,7 @@ jobs:
183186
operator_install_type: ${{ inputs.operator_install_type }}
184187
operator_repo: ${{ inputs.operator_repo }}
185188
operator_upgrade: ${{ inputs.operator_upgrade }}
189+
os_channel: ${{ inputs.os_channel }}
186190
os_to_test: ${{ inputs.os_to_test }}
187191
public_domain: ${{ inputs.public_domain }}
188192
public_fqdn: ${{ inputs.public_fqdn }}

tests/assets/osChannel.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: elemental.cattle.io/v1beta1
2+
kind: ManagedOSVersionChannel
3+
metadata:
4+
name: os-channel-to-test
5+
# namespace: fleet-default
6+
spec:
7+
deleteNoLongerInSyncVersions: true
8+
options:
9+
image: %OS_CHANNEL%
10+
syncInterval: 1h
11+
type: custom

tests/e2e/seedImage_test.go

+42
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"os"
1919
"os/exec"
2020
"strconv"
21+
"strings"
2122
"time"
2223

2324
. "github.com/onsi/ginkgo/v2"
@@ -42,6 +43,47 @@ var _ = Describe("E2E - Creating ISO image", Label("iso-image"), func() {
4243
// Report to Qase
4344
testCaseID = 38
4445

46+
if osChannel != "" {
47+
By("Adding OSChannel to test", func() {
48+
// Get default channel image
49+
defChannel, err := kubectl.RunWithoutErr("get", "managedOSVersionChannel",
50+
"--namespace", clusterNS,
51+
"-o", "jsonpath={.items[0].spec.options.image}")
52+
Expect(err).To(Not(HaveOccurred()))
53+
Expect(defChannel).To(Not(BeEmpty()))
54+
55+
if !strings.Contains(defChannel, osChannel) {
56+
// Set temporary file
57+
osChannelTmp, err := tools.CreateTemp("osChannel")
58+
Expect(err).To(Not(HaveOccurred()))
59+
defer os.Remove(osChannelTmp)
60+
61+
// Save original file as it can be modified multiple time
62+
err = tools.CopyFile(osChannelYaml, osChannelTmp)
63+
Expect(err).To(Not(HaveOccurred()))
64+
65+
// Set the OS channel to test
66+
err = tools.Sed("%OS_CHANNEL%", osChannel, osChannelTmp)
67+
Expect(err).To(Not(HaveOccurred()))
68+
69+
// Apply to k8s
70+
err = kubectl.Apply(clusterNS, osChannelTmp)
71+
Expect(err).To(Not(HaveOccurred()))
72+
73+
// Check that the OS channel to test has been added
74+
const channel = "os-channel-to-test"
75+
newChannel, err := kubectl.RunWithoutErr("get", "managedOSVersionChannel",
76+
"--namespace", clusterNS, channel,
77+
"-o", "jsonpath={.spec.options.image}")
78+
Expect(err).To(Not(HaveOccurred()))
79+
Expect(newChannel).To(Equal(osChannel))
80+
}
81+
82+
// Clear OS_TO_TEST, as Staging and Dev channels manually added do not contain "unstable" tag
83+
os2Test = ""
84+
})
85+
}
86+
4587
By("Adding SeedImage", func() {
4688
var (
4789
baseImageURL string

tests/e2e/suite_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const (
4949
localStorageYaml = "../assets/local-storage.yaml"
5050
metallbRscYaml = "../assets/metallb_rsc.yaml"
5151
numberOfNodesMax = 30
52+
osChannelYaml = "../assets/osChannel.yaml"
5253
resetMachineInv = "../assets/reset_machine_inventory.yaml"
5354
restoreYaml = "../assets/restore.yaml"
5455
sshConfigFile = "../assets/ssh_config"
@@ -78,6 +79,7 @@ var (
7879
operatorInstallType string
7980
operatorRepo string
8081
operatorUpgrade string
82+
osChannel string
8183
os2Test string
8284
poolType string
8385
proxy string
@@ -772,6 +774,7 @@ var _ = BeforeSuite(func() {
772774
operatorInstallType = os.Getenv("OPERATOR_INSTALL_TYPE")
773775
operatorRepo = os.Getenv("OPERATOR_REPO")
774776
operatorUpgrade = os.Getenv("OPERATOR_UPGRADE")
777+
osChannel = os.Getenv("OS_CHANNEL")
775778
os2Test = os.Getenv("OS_TO_TEST")
776779
poolType = os.Getenv("POOL")
777780
proxy = os.Getenv("PROXY")

0 commit comments

Comments
 (0)