Skip to content

Commit

Permalink
ci/ui: install operator from cli for ui upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
juadk committed Sep 25, 2024
1 parent 6425dbe commit 8dc0334
Show file tree
Hide file tree
Showing 24 changed files with 97 additions and 42 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/master_e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ on:
default: false
type: boolean
full_backup_restore:
description: Test migration-like backup/restore functionality
default: false
type: boolean
description: Test migration-like backup/restore functionality
default: false
type: boolean
k8s_downstream_version:
description: Rancher cluster downstream version to use
type: string
Expand All @@ -59,6 +59,10 @@ on:
description: Number of nodes to deploy on the provisioned cluster
default: 5
type: string
operator_install_type:
description: Type of installation to use for the Elemental operator (cli/ui)
default: cli
type: string
operator_repo:
description: Elemental operator repository to use
type: string
Expand Down Expand Up @@ -235,6 +239,7 @@ jobs:
full_backup_restore: ${{ inputs.full_backup_restore }}
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
node_number: ${{ inputs.node_number }}
operator_install_type: ${{ inputs.operator_install_type }}
operator_repo: ${{ inputs.operator_repo }}
operator_upgrade: ${{ inputs.operator_upgrade }}
os_to_test: ${{ inputs.os_to_test }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/sub_cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ on:
node_number:
required: true
type: string
operator_install_type:
required: true
type: string
operator_repo:
required: true
type: string
Expand Down Expand Up @@ -133,6 +136,7 @@ jobs:
K8S_UPSTREAM_VERSION: ${{ inputs.k8s_upstream_version }}
# For K8s cluster to provision with Rancher Manager
K8S_DOWNSTREAM_VERSION: ${{ inputs.k8s_downstream_version }}
OPERATOR_INSTALL_TYPE: ${{ inputs.operator_install_type }}
OS_TO_TEST: ${{ inputs.os_to_test }}
# For Rancher Manager
RANCHER_VERSION: ${{ inputs.rancher_version }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/sub_multi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ on:
k8s_upstream_version:
required: true
type: string
operator_install_type:
required: true
type: string
operator_repo:
required: true
type: string
Expand Down Expand Up @@ -97,6 +100,7 @@ jobs:
K8S_UPSTREAM_VERSION: ${{ inputs.k8s_upstream_version }}
# For K8s cluster to provision with Rancher Manager
K8S_DOWNSTREAM_VERSION: ${{ inputs.k8s_downstream_version }}
OPERATOR_INSTALL_TYPE: ${{ inputs.operator_install_type }}
# For Rancher Manager
RANCHER_VERSION: ${{ inputs.rancher_version }}
TEST_TYPE: ${{ inputs.test_type }}
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/sub_test_choice.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ on:
node_number:
required: true
type: string
operator_install_type:
required: true
type: string
operator_repo:
required: true
type: string
Expand Down Expand Up @@ -177,6 +180,7 @@ jobs:
full_backup_restore: ${{ inputs.full_backup_restore }}
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
node_number: ${{ inputs.node_number }}
operator_install_type: ${{ inputs.operator_install_type }}
operator_repo: ${{ inputs.operator_repo }}
operator_upgrade: ${{ inputs.operator_upgrade }}
os_to_test: ${{ inputs.os_to_test }}
Expand Down Expand Up @@ -211,6 +215,7 @@ jobs:
cluster_number: ${{ inputs.cluster_number }}
cluster_type: ${{ inputs.cluster_type }}
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
operator_install_type: ${{ inputs.operator_install_type }}
operator_repo: ${{ inputs.operator_repo }}
os_to_test: ${{ inputs.os_to_test }}
public_domain: ${{ inputs.public_domain }}
Expand Down Expand Up @@ -238,6 +243,7 @@ jobs:
cypress_tags: ${{ inputs.cypress_tags }}
elemental_ui_version: ${{ inputs.elemental_ui_version }}
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
operator_install_type: ${{ inputs.operator_install_type }}
operator_repo: ${{ inputs.operator_repo }}
os_to_test: ${{ inputs.os_to_test }}
os_version_install: ${{ inputs.os_version_install }}
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/sub_ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ on:
k8s_upstream_version:
required: true
type: string
operator_install_type:
required: true
type: string
operator_repo:
required: true
type: string
Expand Down Expand Up @@ -117,6 +120,7 @@ jobs:
K8S_UPSTREAM_VERSION: ${{ inputs.k8s_upstream_version }}
# For K8s cluster to provision with Rancher Manager
K8S_DOWNSTREAM_VERSION: ${{ inputs.k8s_downstream_version }}
OPERATOR_INSTALL_TYPE: ${{ inputs.operator_install_type }}
steps:
- name: Checkout
id: checkout
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ui-k3s-ibs_stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
elemental_ui_version: ${{ inputs.elemental_ui_version }}
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
k8s_upstream_version: ${{ inputs.k8s_upstream_version }}
operator_install_type: ui
operator_repo: oci://registry.suse.com/rancher
proxy: ${{ inputs.proxy }}
qase_run_id: ${{ inputs.qase_run_id }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ui-k3s-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
elemental_ui_version: dev
k8s_downstream_version: ${{ matrix.k8s_downstream_version }}
k8s_upstream_version: ${{ matrix.k8s_upstream_version }}
operator_install_type: ui
proxy: ${{ inputs.proxy || 'elemental' }}
qase_run_id: ${{ github.event_name == 'schedule' && 'auto' || inputs.qase_run_id }}
rancher_version: ${{ matrix.rancher_version }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ui-k3s-obs_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ jobs:
elemental_ui_version: dev
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
k8s_upstream_version: ${{ inputs.k8s_upstream_version }}
operator_install_type: ui
operator_repo: oci://registry.opensuse.org/isv/rancher/elemental/dev/charts/rancher
proxy: ${{ inputs.proxy }}
qase_run_id: ${{ github.event_name == 'schedule' && 'auto' || inputs.qase_run_id }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ui-k3s-obs_staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
elemental_ui_version: dev
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
k8s_upstream_version: ${{ inputs.k8s_upstream_version }}
operator_install_type: ui
operator_repo: oci://registry.opensuse.org/isv/rancher/elemental/staging/charts/rancher
proxy: ${{ inputs.proxy }}
qase_run_id: ${{ inputs.qase_run_id }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ui-k3s-upgrade-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
elemental_ui_version: stable
k8s_downstream_version: ${{ matrix.k8s_downstream_version }}
k8s_upstream_version: ${{ matrix.k8s_upstream_version }}
operator_repo: oci://registry.suse.com/rancher
proxy: ${{ inputs.proxy || 'elemental' }}
qase_run_id: ${{ github.event_name == 'schedule' && 'auto' || inputs.qase_run_id }}
rancher_version: ${{ matrix.rancher_version }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ui-marketplace-upgrade-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
elemental_ui_version: ${{ inputs.elemental_ui_version }}
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
k8s_upstream_version: ${{ inputs.k8s_upstream_version }}
operator_install_type: ui
operator_repo: marketplace
os_version_install: ${{ inputs.os_version_install }}
os_version_target: ${{ inputs.os_version_target }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ui-marketplace-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
elemental_ui_version: ${{ inputs.elemental_ui_version }}
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
k8s_upstream_version: ${{ inputs.k8s_upstream_version }}
operator_install_type: ui
operator_repo: ${{ inputs.operator_repo }}
os_version_install: ${{ inputs.os_version_install }}
proxy: elemental
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ui-rke2-ibs_stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
elemental_ui_version: ${{ inputs.elemental_ui_version }}
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
k8s_upstream_version: ${{ inputs.k8s_upstream_version }}
operator_install_type: ui
operator_repo: oci://registry.suse.com/rancher
qase_run_id: ${{ inputs.qase_run_id }}
rancher_version: ${{ inputs.rancher_version }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ui-rke2-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
elemental_ui_version: dev
k8s_downstream_version: ${{ matrix.k8s_downstream_version }}
k8s_upstream_version: ${{ matrix.k8s_upstream_version }}
operator_install_type: ui
proxy: ${{ inputs.proxy || 'elemental' }}
qase_run_id: ${{ github.event_name == 'schedule' && 'auto' || inputs.qase_run_id }}
rancher_version: ${{ matrix.rancher_version }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ui-rke2-obs_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
elemental_ui_version: dev
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
k8s_upstream_version: ${{ inputs.k8s_upstream_version }}
operator_install_type: ui
operator_repo: oci://registry.opensuse.org/isv/rancher/elemental/dev/charts/rancher
qase_run_id: ${{ inputs.qase_run_id }}
rancher_version: ${{ inputs.rancher_version }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ui-rke2-obs_staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ jobs:
elemental_ui_version: dev
k8s_downstream_version: ${{ inputs.k8s_downstream_version }}
k8s_upstream_version: ${{ inputs.k8s_upstream_version }}
operator_install_type: ui
operator_repo: oci://registry.opensuse.org/isv/rancher/elemental/staging/charts/rancher
qase_run_id: ${{ inputs.qase_run_id }}
rancher_version: ${{ inputs.rancher_version }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ui-rke2-upgrade-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ jobs:
k8s_downstream_version: ${{ matrix.k8s_downstream_version }}
k8s_upstream_version: ${{ matrix.k8s_upstream_version }}
proxy: ${{ inputs.proxy || 'elemental' }}
operator_repo: oci://registry.suse.com/rancher
qase_run_id: ${{ github.event_name == 'schedule' && 'auto' || inputs.qase_run_id }}
rancher_version: ${{ matrix.rancher_version }}
test_type: ui
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import '~/support/commands';
import filterTests from '~/support/filterTests.js';
import * as cypressLib from '@rancher-ecp-qa/cypress-library';
import { qase } from 'cypress-qase-reporter/dist/mocha';
import { isCypressTag, isGitRepo, isOperatorVersion, isRancherManagerVersion } from '~/support/utils';
import { isCypressTag, isGitRepo, isOperatorInstallType, isOperatorVersion, isRancherManagerVersion } from '~/support/utils';
import { Elemental } from '~/support/elemental';

filterTests(['main', 'upgrade'], () => {
Expand Down Expand Up @@ -47,7 +47,7 @@ filterTests(['main', 'upgrade'], () => {
it('Install latest dev Elemental operator', () => {
elemental.installElementalOperator(upgradeFromVersion);
}));
} else if (!isRancherManagerVersion('2.7')) {
} else if (!isRancherManagerVersion('2.7') && !isOperatorInstallType('cli')) {
qase(57,
it('Install latest stable Elemental operator', () => {
elemental.installElementalOperator(upgradeFromVersion);
Expand Down
4 changes: 3 additions & 1 deletion tests/cypress/latest/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ module.exports = (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions)
config.env.cache_session = process.env.CACHE_SESSION || false;
config.env.chartmuseum_repo = process.env.CHARTMUSEUM_REPO;
config.env.cluster = process.env.CLUSTER_NAME;
config.env.container_stable_os_version = process.env.CONTAINER_STABLE_OS_VERSION;
config.env.cypress_tags = process.env.CYPRESS_TAGS;
config.env.elemental_dev_version = process.env.ELEMENTAL_DEV_VERSION;
config.env.elemental_ui_version = process.env.ELEMENTAL_UI_VERSION;
config.env.k8s_downstream_version = process.env.K8S_DOWNSTREAM_VERSION;
config.env.operator_install_type = process.env.OPERATOR_INSTALL_TYPE;
config.env.operator_repo = process.env.OPERATOR_REPO;
config.env.os_version_install = process.env.OS_VERSION_INSTALL;
config.env.os_version_target = process.env.OS_VERSION_TARGET;
Expand All @@ -46,7 +48,7 @@ module.exports = (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions)
config.env.rancher_git_chart = process.env.RANCHER_GIT_CHART;
config.env.rancher_channel = process.env.RANCHER_CHANNEL;
config.env.rancher_version = process.env.RANCHER_VERSION;
config.env.stable_os_version = process.env.STABLE_OS_VERSION;
config.env.iso_stable_os_version = process.env.ISO_STABLE_OS_VERSION;
config.env.ui_account = process.env.UI_ACCOUNT;
config.env.upgrade_from_version = process.env.UPGRADE_FROM_VERSION;
config.env.upgrade_image = process.env.UPGRADE_IMAGE;
Expand Down
6 changes: 5 additions & 1 deletion tests/cypress/latest/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ Cypress.Commands.add('createMachReg', (
} else if (utils.isOperatorVersion('marketplace')) {
cy.contains(Cypress.env('os_version_install')).click();
} else {
cy.contains(new RegExp(`ISO.*${Cypress.env('stable_os_version')}`)).click();
if (utils.isBootType('raw')) {
cy.contains(new RegExp(`OS.*${Cypress.env('container_stable_os_version')}`)).click();
} else {
cy.contains(new RegExp(`ISO.*${Cypress.env('iso_stable_os_version')}`)).click();
}
}
} else if (utils.isOperatorVersion('registry.suse.com') || utils.isOperatorVersion('marketplace')) {
cy.contains(Cypress.env('os_version_install')).click();
Expand Down
5 changes: 5 additions & 0 deletions tests/cypress/latest/support/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ export const isRancherPrime = () => {
return (new RegExp('prime')).test(Cypress.env("rancher_channel"));
}

// Check how to install the operator
export const isOperatorInstallType = (type: string) => {
return (new RegExp(type)).test(Cypress.env("operator_install_type"));
}

// Check the Elemental operator version
export const isOperatorVersion = (version: string) => {
return (new RegExp(version)).test(Cypress.env("operator_repo"));
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/install_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ var _ = Describe("E2E - Install Rancher Manager", Label("install"), func() {

// Deploy operator in CLI test
It("Install Elemental Operator if needed", func() {
if testType == "cli" || testType == "multi" {
By("Installing Operator for CLI tests", func() {
if operatorInstallType == "cli" {
By("Installing Operator with CLI", func() {
// Report to Qase
testCaseID = 62

Expand Down
6 changes: 4 additions & 2 deletions tests/e2e/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ var (
netDefaultFileName string
numberOfClusters int
numberOfVMs int
operatorUpgrade string
operatorInstallType string
operatorRepo string
operatorUpgrade string
os2Test string
poolType string
proxy string
Expand Down Expand Up @@ -757,8 +758,9 @@ var _ = BeforeSuite(func() {
k8sUpstreamVersion = os.Getenv("K8S_UPSTREAM_VERSION")
number := os.Getenv("VM_NUMBERS")
clusterNumber := os.Getenv("CLUSTER_NUMBER")
operatorUpgrade = os.Getenv("OPERATOR_UPGRADE")
operatorInstallType = os.Getenv("OPERATOR_INSTALL_TYPE")
operatorRepo = os.Getenv("OPERATOR_REPO")
operatorUpgrade = os.Getenv("OPERATOR_UPGRADE")
os2Test = os.Getenv("OS_TO_TEST")
poolType = os.Getenv("POOL")
proxy = os.Getenv("PROXY")
Expand Down
69 changes: 38 additions & 31 deletions tests/scripts/start-cypress-tests
Original file line number Diff line number Diff line change
Expand Up @@ -30,41 +30,48 @@ which yq >/dev/null 2>&1
OS_IMAGE=$(helm template oci://registry.suse.com/rancher/elemental-operator-chart \
| yq 'select(.kind=="ManagedOSVersionChannel") .spec.options.image')

STABLE_OS_VERSION=$(docker run --entrypoint busybox ${OS_IMAGE} cat channel.json \
| jq -r '.[].spec.version' \
ISO_STABLE_OS_VERSION=$(docker run --entrypoint busybox ${OS_IMAGE} cat channel.json \
| jq -r '.[].spec |select(.type=="iso").version' \
| sort -V \
| tail -1)

CONTAINER_STABLE_OS_VERSION=$(docker run --entrypoint busybox ${OS_IMAGE} cat channel.json \
| jq -r '.[].spec |select(.type=="container").version' \
| sort -V \
| tail -1)

# Start Cypress tests with docker
docker run -v $PWD:/workdir -w /workdir \
-e BOOT_TYPE=$BOOT_TYPE \
-e CYPRESS_TAGS=$CYPRESS_TAGS \
-e ELEMENTAL_DEV_VERSION=$ELEMENTAL_DEV_VERSION \
-e ELEMENTAL_UI_VERSION=$ELEMENTAL_UI_VERSION \
-e CHARTMUSEUM_REPO=$CHARTMUSEUM_REPO \
-e K8S_UPSTREAM_VERSION=$K8S_UPSTREAM_VERSION \
-e K8S_DOWNSTREAM_VERSION=$K8S_DOWNSTREAM_VERSION \
-e OPERATOR_REPO=$OPERATOR_REPO \
-e OS_VERSION_INSTALL=$OS_VERSION_INSTALL \
-e OS_VERSION_TARGET=$OS_VERSION_TARGET \
-e PROXY=$PROXY \
-e QASE_API_TOKEN=$QASE_API_TOKEN \
-e QASE_REPORT=$QASE_REPORT \
-e QASE_RUN_ID=$QASE_RUN_ID \
-e RANCHER_CHANNEL=$RANCHER_CHANNEL \
-e RANCHER_GIT_CHART=$RANCHER_GIT_CHART \
-e RANCHER_VERSION=$RANCHER_VERSION \
-e RANCHER_PASSWORD=$RANCHER_PASSWORD \
-e RANCHER_URL=$RANCHER_URL \
-e RANCHER_USER=$RANCHER_USER \
-e STABLE_OS_VERSION=$STABLE_OS_VERSION \
-e UI_ACCOUNT=$UI_ACCOUNT \
-e UPGRADE_FROM_VERSION=$UPGRADE_FROM_VERSION \
-e UPGRADE_IMAGE=$UPGRADE_IMAGE \
-e UPGRADE_OS_CHANNEL=$UPGRADE_OS_CHANNEL \
--add-host host.docker.internal:host-gateway \
--ipc=host \
$CYPRESS_DOCKER \
docker run -v $PWD:/workdir -w /workdir \
-e BOOT_TYPE=$BOOT_TYPE \
-e CYPRESS_TAGS=$CYPRESS_TAGS \
-e ELEMENTAL_DEV_VERSION=$ELEMENTAL_DEV_VERSION \
-e ELEMENTAL_UI_VERSION=$ELEMENTAL_UI_VERSION \
-e CHARTMUSEUM_REPO=$CHARTMUSEUM_REPO \
-e CONTAINER_STABLE_OS_VERSION=$CONTAINER_STABLE_OS_VERSION \
-e K8S_UPSTREAM_VERSION=$K8S_UPSTREAM_VERSION \
-e K8S_DOWNSTREAM_VERSION=$K8S_DOWNSTREAM_VERSION \
-e OPERATOR_INSTALL_TYPE=$OPERATOR_INSTALL_TYPE \
-e OPERATOR_REPO=$OPERATOR_REPO \
-e OS_VERSION_INSTALL=$OS_VERSION_INSTALL \
-e OS_VERSION_TARGET=$OS_VERSION_TARGET \
-e PROXY=$PROXY \
-e QASE_API_TOKEN=$QASE_API_TOKEN \
-e QASE_REPORT=$QASE_REPORT \
-e QASE_RUN_ID=$QASE_RUN_ID \
-e RANCHER_CHANNEL=$RANCHER_CHANNEL \
-e RANCHER_GIT_CHART=$RANCHER_GIT_CHART \
-e RANCHER_VERSION=$RANCHER_VERSION \
-e RANCHER_PASSWORD=$RANCHER_PASSWORD \
-e RANCHER_URL=$RANCHER_URL \
-e RANCHER_USER=$RANCHER_USER \
-e ISO_STABLE_OS_VERSION=$ISO_STABLE_OS_VERSION \
-e UI_ACCOUNT=$UI_ACCOUNT \
-e UPGRADE_FROM_VERSION=$UPGRADE_FROM_VERSION \
-e UPGRADE_IMAGE=$UPGRADE_IMAGE \
-e UPGRADE_OS_CHANNEL=$UPGRADE_OS_CHANNEL \
--add-host host.docker.internal:host-gateway \
--ipc=host \
$CYPRESS_DOCKER \
-s $SPEC

[[ -d downloads ]] && sudo chown -R gh-runner:users downloads videos
Expand Down

0 comments on commit 8dc0334

Please sign in to comment.