Skip to content

Commit

Permalink
ci: use SeedImage for all CLI tests
Browse files Browse the repository at this point in the history
Signed-off-by: Loic Devulder <[email protected]>
  • Loading branch information
ldevulder committed Oct 3, 2023
1 parent a0f7a71 commit 9b0b84b
Show file tree
Hide file tree
Showing 22 changed files with 281 additions and 270 deletions.
1 change: 0 additions & 1 deletion .github/workflows/cli-k3s-ibs_stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
cluster_name: cluster-k3s
cluster_type: ${{ inputs.cluster_type }}
destroy_runner: ${{ inputs.destroy_runner }}
iso_to_test: https://updates.suse.com/SUSE/Products/ElementalTeal/5.4/x86_64/iso/elemental-teal.x86_64-1.2.2-GM.iso
k8s_version_to_provision: v1.26.8+k3s1
operator_repo: oci://registry.suse.com/rancher
rancher_version: ${{ inputs.rancher_version }}
1 change: 0 additions & 1 deletion .github/workflows/cli-k3s-obs_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
cluster_name: cluster-k3s
cluster_type: ${{ inputs.cluster_type }}
destroy_runner: ${{ inputs.destroy_runner }}
iso_to_test: https://download.opensuse.org/repositories/isv:/Rancher:/Elemental:/Dev/containers/iso/elemental-teal.x86_64.iso
k8s_version_to_provision: v1.26.8+k3s1
operator_repo: oci://registry.opensuse.org/isv/rancher/elemental/dev/charts/rancher
rancher_version: ${{ inputs.rancher_version }}
1 change: 0 additions & 1 deletion .github/workflows/cli-k3s-obs_staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
cluster_name: cluster-k3s
cluster_type: ${{ inputs.cluster_type }}
destroy_runner: ${{ inputs.destroy_runner }}
iso_to_test: https://download.opensuse.org/repositories/isv:/Rancher:/Elemental:/Staging/containers/iso/elemental-teal.x86_64.iso
k8s_version_to_provision: v1.26.8+k3s1
operator_repo: oci://registry.opensuse.org/isv/rancher/elemental/staging/charts/rancher
rancher_version: ${{ inputs.rancher_version }}
1 change: 0 additions & 1 deletion .github/workflows/cli-k3s-os-upgrade-rancher_latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
with:
test_description: "CI - CLI - Parallel - OS Upgrade test with Standard K3s"
cluster_name: cluster-k3s
iso_to_test: https://updates.suse.com/SUSE/Products/ElementalTeal/5.4/x86_64/iso/elemental-teal.x86_64-1.2.2-GM.iso
k8s_version_to_provision: v1.26.8+k3s1
node_number: 5
operator_upgrade: oci://registry.opensuse.org/isv/rancher/elemental/dev/charts/rancher
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/cli-k3s-os-upgrade-rancher_stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
with:
test_description: "CI - CLI - Parallel - OS Upgrade test with Standard K3s"
cluster_name: cluster-k3s
iso_to_test: https://updates.suse.com/SUSE/Products/ElementalTeal/5.4/x86_64/iso/elemental-teal.x86_64-1.2.2-GM.iso
k8s_version_to_provision: v1.26.8+k3s1
node_number: 5
operator_upgrade: oci://registry.opensuse.org/isv/rancher/elemental/dev/charts/rancher
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/cli-k3s-os-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ on:
description: Destroy the auto-generated self-hosted runner
default: true
type: boolean
iso_to_test:
description: ISO to test
default: https://updates.suse.com/SUSE/Products/ElementalTeal/5.4/x86_64/iso/elemental-teal.x86_64-1.2.2-GM.iso
type: string
operator_repo:
description: Operator version to use for initial deployment
default: oci://registry.opensuse.org/rancher
Expand Down Expand Up @@ -53,7 +49,6 @@ jobs:
qase_run_id: ${{ inputs.qase_run_id }}
cluster_name: cluster-k3s
destroy_runner: ${{ inputs.destroy_runner }}
iso_to_test: ${{ inputs.iso_to_test }}
k8s_version_to_provision: v1.26.8+k3s1
node_number: 5
operator_upgrade: oci://registry.opensuse.org/isv/rancher/elemental/${{ inputs.upgrade_os_channel }}/charts/rancher
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/cli-obs-manual-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ on:
description: Destroy the auto-generated self-hosted runner
default: true
type: boolean
iso_to_test:
description: Defines the ISO to test
default: https://download.opensuse.org/repositories/isv:/Rancher:/Elemental:/Dev/containers/iso/elemental-teal.x86_64.iso
type: string
k8s_version:
description: Version of K3s/RKE2 to use (for both upstream and downstream clusters)
default: v1.26.8+k3s1
Expand Down Expand Up @@ -61,7 +57,6 @@ jobs:
cluster_name: my-own-cluster
cluster_type: ${{ inputs.cluster_type }}
destroy_runner: ${{ inputs.destroy_runner }}
iso_to_test: ${{ inputs.iso_to_test }}
k8s_version_to_provision: ${{ inputs.k8s_version }}
node_number: ${{ inputs.node_number }}
operator_repo: ${{ inputs.operator_repo }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cli-rke2-ibs_stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:
cluster_name: cluster-rke2
cluster_type: ${{ inputs.cluster_type }}
destroy_runner: ${{ inputs.destroy_runner }}
iso_to_test: https://updates.suse.com/SUSE/Products/ElementalTeal/5.4/x86_64/iso/elemental-teal.x86_64-1.2.2-GM.iso
k8s_version_to_provision: v1.26.8+rke2r1
operator_repo: oci://registry.suse.com/rancher
os_to_test: stable
rancher_version: ${{ inputs.rancher_version }}
upstream_cluster_version: v1.26.8+rke2r1
2 changes: 1 addition & 1 deletion .github/workflows/cli-rke2-obs_dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:
cluster_name: cluster-rke2
cluster_type: ${{ inputs.cluster_type }}
destroy_runner: ${{ inputs.destroy_runner }}
iso_to_test: https://download.opensuse.org/repositories/isv:/Rancher:/Elemental:/Dev/containers/iso/elemental-teal.x86_64.iso
k8s_version_to_provision: v1.26.8+rke2r1
operator_repo: oci://registry.opensuse.org/isv/rancher/elemental/dev/charts/rancher
os_to_test: dev
rancher_version: ${{ inputs.rancher_version }}
upstream_cluster_version: v1.26.8+rke2r1
2 changes: 1 addition & 1 deletion .github/workflows/cli-rke2-obs_staging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ jobs:
cluster_name: cluster-rke2
cluster_type: ${{ inputs.cluster_type }}
destroy_runner: ${{ inputs.destroy_runner }}
iso_to_test: https://download.opensuse.org/repositories/isv:/Rancher:/Elemental:/Staging/containers/iso/elemental-teal.x86_64.iso
k8s_version_to_provision: v1.26.8+rke2r1
operator_repo: oci://registry.opensuse.org/isv/rancher/elemental/staging/charts/rancher
os_to_test: staging
rancher_version: ${{ inputs.rancher_version }}
upstream_cluster_version: v1.26.8+rke2r1
1 change: 0 additions & 1 deletion .github/workflows/cli-rke2-os-upgrade-rancher_latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
test_description: "CI - CLI - Parallel - OS Upgrade test with Standard RKE2"
ca_type: private
cluster_name: cluster-rke2
iso_to_test: https://updates.suse.com/SUSE/Products/ElementalTeal/5.4/x86_64/iso/elemental-teal.x86_64-1.2.2-GM.iso
k8s_version_to_provision: v1.26.8+rke2r1
node_number: 5
operator_upgrade: oci://registry.opensuse.org/isv/rancher/elemental/dev/charts/rancher
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/cli-rke2-os-upgrade-rancher_stable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
test_description: "CI - CLI - Parallel - OS Upgrade test with Standard RKE2"
ca_type: private
cluster_name: cluster-rke2
iso_to_test: https://updates.suse.com/SUSE/Products/ElementalTeal/5.4/x86_64/iso/elemental-teal.x86_64-1.2.2-GM.iso
k8s_version_to_provision: v1.26.8+rke2r1
node_number: 5
operator_upgrade: oci://registry.opensuse.org/isv/rancher/elemental/dev/charts/rancher
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/cli-rke2-os-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ on:
description: Destroy the auto-generated self-hosted runner
default: true
type: boolean
iso_to_test:
description: ISO to test
default: https://updates.suse.com/SUSE/Products/ElementalTeal/5.4/x86_64/iso/elemental-teal.x86_64-1.2.2-GM.iso
type: string
operator_repo:
description: Operator version to use for initial deployment
default: oci://registry.opensuse.org/rancher
Expand Down Expand Up @@ -54,7 +50,6 @@ jobs:
ca_type: private
cluster_name: cluster-rke2
destroy_runner: ${{ inputs.destroy_runner }}
iso_to_test: ${{ inputs.iso_to_test }}
k8s_version_to_provision: v1.26.8+rke2r1
node_number: 5
operator_upgrade: oci://registry.opensuse.org/isv/rancher/elemental/${{ inputs.upgrade_os_channel }}/charts/rancher
Expand Down
145 changes: 62 additions & 83 deletions .github/workflows/master-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ on:
description: Version of the elemental ui which will be installed (dev/stable)
default: dev
type: string
iso_to_test:
description: ISO to test (default built one is empty)
type: string
iso_boot:
description: Choose booting from ISO
type: boolean
Expand All @@ -85,6 +82,10 @@ on:
operator_upgrade:
description: Elemental operator version to upgrade to
type: string
os_to_test:
description: OS repository to test (dev/staging/stable)
type: string
default: dev
proxy:
description: Deploy a proxy
type: string
Expand Down Expand Up @@ -233,45 +234,6 @@ jobs:
uses: actions/setup-go@v3
with:
go-version-file: tests/go.mod
- name: Cache ISO
# NOTE: download the *default* ISO, not the one passed as a parameter
if: inputs.iso_to_test == ''
uses: actions/cache@v3
env:
cache-name: cache-artifacts
with:
path: build/*
key: build-ci-${{ github.event.pull_request.head.sha || github.sha }}
# Alternate key, mainly useful for UI test
restore-keys: |
build-ci-
- name: Download specified ISO
if: inputs.iso_to_test != ''
env:
ISO_TO_TEST: ${{ inputs.iso_to_test }}
TAG: from-obs
run: |
ARCH=$(uname -m)
mkdir -p build
wget -v -L -c ${ISO_TO_TEST} -O build/elemental-teal.${ARCH}-${TAG}.iso
- name: Create symbolic link to ISO for SeedImage
run: |
ISO=$(ls build/*.iso 2> /dev/null)
ln -sf ${ISO} base-image.iso
- name: Extract iPXE artifacts from ISO
run: |
# Extract TAG
ARCH=$(uname -m)
ISO=$(ls build/*.iso 2> /dev/null)
TAG=${ISO#*.${ARCH}-}
export TAG=${TAG%.iso}
# Extract iPXE artifacts
make extract_kernel_init_squash
make ipxe
# Extend regexes (needed for the next 'mv' command)
shopt -s extglob
# Looks a little bit weird but we have to keep the ISO in build!
mv -f build/!(*.iso) .
- name: Deploy Proxy
if: inputs.proxy == 'elemental' || inputs.proxy == 'rancher'
run: docker run -d --name squid_proxy -v $(pwd)/tests/assets/squid.conf:/etc/squid/squid.conf -p 3128:3128 wernight/squid
Expand All @@ -289,46 +251,12 @@ jobs:
# Check if DynamicSchemas for MachineInventorySelectorTemplate exists
if ! kubectl get dynamicschema machineinventoryselectortemplate >/dev/null 2>&1; then
# If not we have to add it to avoid weird issues!
echo "WORKAROUND: DynamicSchemas for MachineInventorySelectorTemplate is missing!"
kubectl apply -f tests/assets/add_missing_dynamicschemas.yaml
fi
- name: Install backup-restore components (K3s only for now)
if: contains(inputs.upstream_cluster_version, 'k3s')
run: cd tests && make e2e-install-backup-restore
- name: Extracts component versions/informations
id: component
run: |
# Extract rancher-backup-operator version
BACKUP_RESTORE_VERSION=$(kubectl get pod \
--namespace cattle-resources-system \
-l app.kubernetes.io/name=rancher-backup \
-o jsonpath={.items[*].status.containerStatuses[*].image} 2> /dev/null || true)
# Extract CertManager version
CERT_MANAGER_VERSION=$(kubectl get pod \
--namespace cert-manager \
-l app=cert-manager \
-o jsonpath={.items[*].status.containerStatuses[*].image} 2> /dev/null || true)
# Extract elemental-operator version
OPERATOR_VERSION=$(kubectl get pod \
--namespace cattle-elemental-system \
-l app=elemental-operator \
-o jsonpath={.items[*].status.containerStatuses[*].image} 2> /dev/null || true)
# Extract Rancher Manager version
RM_VERSION=$(kubectl get pod \
--namespace cattle-system \
-l app=rancher \
-o jsonpath={.items[*].status.containerStatuses[*].image} 2> /dev/null || true)
# Extract OS version from ISO
INITRD_FILE=$(isoinfo -i build/*.iso -R -find -type f -name initrd -print 2>/dev/null)
isoinfo -i build/*.iso -R -x ${INITRD_FILE} 2>/dev/null \
| xz -dc \
| cpio -i --to-stdout usr/lib/initrd-release > os-release
eval $(grep IMAGE_TAG os-release)
# Export values
echo "backup_restore_version=${BACKUP_RESTORE_VERSION}" >> ${GITHUB_OUTPUT}
echo "cert_manager_version=${CERT_MANAGER_VERSION}" >> ${GITHUB_OUTPUT}
echo "image_tag=${IMAGE_TAG}" >> ${GITHUB_OUTPUT}
echo "operator_version=${OPERATOR_VERSION}" >> ${GITHUB_OUTPUT}
echo "rm_version=${RM_VERSION}" >> ${GITHUB_OUTPUT}
- name: Cypress tests - Basics
# Basics means tests without an extra elemental node needed
if: inputs.test_type == 'ui'
Expand All @@ -338,7 +266,6 @@ jobs:
CYPRESS_TAGS: ${{ inputs.cypress_tags }}
ELEMENTAL_UI_VERSION: ${{ inputs.elemental_ui_version }}
ISO_BOOT: ${{ inputs.iso_boot }}
ISO_TO_TEST: ${{ inputs.iso_to_test }}
K8S_UPSTREAM_VERSION: ${{ inputs.upstream_cluster_version }}
OPERATOR_REPO: ${{ inputs.operator_repo }}
RANCHER_VERSION: ${{ steps.component.outputs.rm_version }}
Expand Down Expand Up @@ -428,6 +355,55 @@ jobs:
- name: Configure Rancher & Libvirt
if: inputs.test_type == 'cli'
run: cd tests && make e2e-configure-rancher
- name: Create ISO image for master pool
if: inputs.test_type == 'cli'
env:
EMULATE_TPM: true
OS_TO_TEST: ${{ inputs.os_to_test }}
POOL: master
run: cd tests && make e2e-iso-image
- name: Extract iPXE artifacts from ISO
if: inputs.test_type == 'cli'
run: |
# Extract iPXE artifacts
make extract_kernel_init_squash
make ipxe
- name: Extracts component versions/informations
id: component
run: |
# Extract rancher-backup-operator version
BACKUP_RESTORE_VERSION=$(kubectl get pod \
--namespace cattle-resources-system \
-l app.kubernetes.io/name=rancher-backup \
-o jsonpath={.items[*].status.containerStatuses[*].image} 2> /dev/null || true)
# Extract CertManager version
CERT_MANAGER_VERSION=$(kubectl get pod \
--namespace cert-manager \
-l app=cert-manager \
-o jsonpath={.items[*].status.containerStatuses[*].image} 2> /dev/null || true)
# Extract elemental-operator version
OPERATOR_VERSION=$(kubectl get pod \
--namespace cattle-elemental-system \
-l app=elemental-operator \
-o jsonpath={.items[*].status.containerStatuses[*].image} 2> /dev/null || true)
# Extract Rancher Manager version
RM_VERSION=$(kubectl get pod \
--namespace cattle-system \
-l app=rancher \
-o jsonpath={.items[*].status.containerStatuses[*].image} 2> /dev/null || true)
# Extract OS version from ISO
ISO=$(file -Ls *.iso 2>/dev/null | awk -F':' '/boot sector/ { print $1 }')
INITRD_FILE=$(isoinfo -i ${ISO} -R -find -type f -name initrd -print 2>/dev/null)
isoinfo -i ${ISO} -R -x ${INITRD_FILE} 2>/dev/null \
| xz -dc \
| cpio -i --to-stdout usr/lib/initrd-release > os-release
eval $(grep IMAGE_TAG os-release)
# Export values
echo "backup_restore_version=${BACKUP_RESTORE_VERSION}" >> ${GITHUB_OUTPUT}
echo "cert_manager_version=${CERT_MANAGER_VERSION}" >> ${GITHUB_OUTPUT}
echo "image_tag=${IMAGE_TAG}" >> ${GITHUB_OUTPUT}
echo "operator_version=${OPERATOR_VERSION}" >> ${GITHUB_OUTPUT}
echo "rm_version=${RM_VERSION}" >> ${GITHUB_OUTPUT}
- name: Bootstrap node 1, 2 and 3 in pool "master" (use Emulated TPM if possible)
if: inputs.test_type == 'cli'
env:
Expand Down Expand Up @@ -534,6 +510,12 @@ jobs:
if ${{ contains(inputs.upstream_cluster_version, 'k3s') }}; then
make e2e-check-app
fi
- name: Create ISO image for worker pool
if: inputs.test_type == 'cli'
env:
OS_TO_TEST: ${{ inputs.os_to_test }}
POOL: worker
run: cd tests && make e2e-iso-image
- name: Bootstrap additional nodes in pool "worker" (total of ${{ inputs.node_number }})
if: inputs.test_type == 'cli' && inputs.node_number > 3
env:
Expand Down Expand Up @@ -597,10 +579,7 @@ jobs:
if ${{ inputs.sequential == 'true' }}; then
BOOTSTRAP_METHOD="Sequential"
fi
ISO_USED=$(ls build/elemental-*.iso 2> /dev/null)
if ${{ inputs.iso_to_test != '' }}; then
ISO_USED=${{ inputs.iso_to_test }}
fi
ISO=$(file -Ls *.iso 2>/dev/null | awk -F':' '/boot sector/ { print $1 }')
# Get nodes configuration (use the first one, they are all identical)
NODE=$(sudo virsh list --name | head -1)
if [[ -n "${NODE}" ]]; then
Expand All @@ -622,7 +601,7 @@ jobs:
echo "Rancher Manager Version: ${{ inputs.rancher_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "CertManager Image: ${{ steps.component.outputs.cert_manager_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "### Elemental" >> ${GITHUB_STEP_SUMMARY}
echo "Elemental ISO used: ${ISO_USED}" >> ${GITHUB_STEP_SUMMARY}
echo "Elemental ISO used: ${ISO}" >> ${GITHUB_STEP_SUMMARY}
echo "Elemental OS version: ${{ steps.component.outputs.image_tag }}" >> ${GITHUB_STEP_SUMMARY}
echo "Elemental Operator Image: ${{ steps.component.outputs.operator_version }}" >> ${GITHUB_STEP_SUMMARY}
echo "Elemental Backup/Restore Operator Image: ${{ steps.component.outputs.backup_restore_version }}" >> ${GITHUB_STEP_SUMMARY}
Expand Down
Loading

0 comments on commit 9b0b84b

Please sign in to comment.