Skip to content

Commit

Permalink
ci/ui: automate latest os version selection
Browse files Browse the repository at this point in the history
  • Loading branch information
juadk committed Jul 4, 2024
1 parent 3488ddb commit 7d254cd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/cypress/latest/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module.exports = (on: Cypress.PluginEvents, config: Cypress.PluginConfigOptions)
config.env.proxy_ip = process.env.PROXY_IP;
config.env.proxy = process.env.PROXY;
config.env.rancher_version = process.env.RANCHER_VERSION;
config.env.stable_os_version = process.env.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
4 changes: 2 additions & 2 deletions tests/cypress/latest/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ Cypress.Commands.add('createMachReg', (
cy.contains(Cypress.env('os_version_install'))
.click();
} else {
cy.contains('ISO v2.0.2')
.click();
cy.contains(new RegExp('ISO.*'+ Cypress.env('stable_os_version')))
.click();
}
} else if (utils.isOperatorVersion('registry.suse.com') || utils.isOperatorVersion('marketplace')) {
cy.contains(Cypress.env('os_version_install'))
Expand Down
14 changes: 14 additions & 0 deletions tests/scripts/start-cypress-tests
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ npm install
# Check if we have to report to QASE
[[ -n $QASE_RUN_ID ]] && QASE_REPORT=1

# Install yq for parsing yaml files
# TODO: yq will be added into the next OS image
sudo zypper in -y yq

# Get latest stable Elemental OS version mainly for upgrade test
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' \
| sort -V \
| tail -1)

# Start Cypress tests with docker
docker run -v $PWD:/workdir -w /workdir \
-e BOOT_TYPE=$BOOT_TYPE \
Expand All @@ -38,6 +51,7 @@ docker run -v $PWD:/workdir -w /workdir \
-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 \
Expand Down

0 comments on commit 7d254cd

Please sign in to comment.