-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add eco-gotests suites ibu #81178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Add eco-gotests suites ibu #81178
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,32 +22,31 @@ echo "" | |
| # Copy inventory from SHARED_DIR (already processed by earlier hub-deploy step) | ||
| echo "=== Copying inventory for seed hub ${CLUSTER_NAME} from SHARED_DIR ===" | ||
|
|
||
| # Set up ocp-deployment inventory (used by ibu-prepare-seed-sno.yml and ibu-poweroff-seed-spoke.yml) | ||
| # Use seed- prefixed files explicitly to avoid ambiguity with target hub files in SHARED_DIR | ||
| # Set up ocp-deployment inventory (used by prepare-ibu-seed-sno.yml and ibu-poweroff-seed-spoke.yml) | ||
| mkdir -p "${OCP_DEPLOYMENT_INVENTORY_PATH}/group_vars" | ||
| mkdir -p "${OCP_DEPLOYMENT_INVENTORY_PATH}/host_vars" | ||
|
|
||
| cp "${SHARED_DIR}/seed-all" "${OCP_DEPLOYMENT_INVENTORY_PATH}/group_vars/all" | ||
| cp "${SHARED_DIR}/seed-bastions" "${OCP_DEPLOYMENT_INVENTORY_PATH}/group_vars/bastions" | ||
| cp "${SHARED_DIR}/seed-hypervisors" "${OCP_DEPLOYMENT_INVENTORY_PATH}/group_vars/hypervisors" | ||
| cp "${SHARED_DIR}/seed-nodes" "${OCP_DEPLOYMENT_INVENTORY_PATH}/group_vars/nodes" | ||
| cp "${SHARED_DIR}/seed-masters" "${OCP_DEPLOYMENT_INVENTORY_PATH}/group_vars/masters" | ||
| cp "${SHARED_DIR}/seed-bastion" "${OCP_DEPLOYMENT_INVENTORY_PATH}/host_vars/bastion" | ||
| cp "${SHARED_DIR}/seed-hypervisor" "${OCP_DEPLOYMENT_INVENTORY_PATH}/host_vars/hypervisor" | ||
| cp "${SHARED_DIR}/seed-master0" "${OCP_DEPLOYMENT_INVENTORY_PATH}/host_vars/master0" | ||
| cp "${SHARED_DIR}/all" "${OCP_DEPLOYMENT_INVENTORY_PATH}/group_vars/all" | ||
| cp "${SHARED_DIR}/bastions" "${OCP_DEPLOYMENT_INVENTORY_PATH}/group_vars/bastions" | ||
| cp "${SHARED_DIR}/hypervisors" "${OCP_DEPLOYMENT_INVENTORY_PATH}/group_vars/hypervisors" | ||
| cp "${SHARED_DIR}/nodes" "${OCP_DEPLOYMENT_INVENTORY_PATH}/group_vars/nodes" | ||
| cp "${SHARED_DIR}/masters" "${OCP_DEPLOYMENT_INVENTORY_PATH}/group_vars/masters" | ||
| cp "${SHARED_DIR}/bastion" "${OCP_DEPLOYMENT_INVENTORY_PATH}/host_vars/bastion" | ||
| cp "${SHARED_DIR}/hypervisor" "${OCP_DEPLOYMENT_INVENTORY_PATH}/host_vars/hypervisor" | ||
| cp "${SHARED_DIR}/master0" "${OCP_DEPLOYMENT_INVENTORY_PATH}/host_vars/master0" | ||
|
|
||
| # Set up cnf inventory (used by deploy-run-eco-gotests.yaml) | ||
| mkdir -p "${CNF_INVENTORY_PATH}/group_vars" | ||
| mkdir -p "${CNF_INVENTORY_PATH}/host_vars" | ||
|
|
||
| cp "${SHARED_DIR}/seed-masters" "${CNF_INVENTORY_PATH}/group_vars/masters.yaml" | ||
| cp "${SHARED_DIR}/seed-nodes" "${CNF_INVENTORY_PATH}/group_vars/nodes.yaml" | ||
| cp "${SHARED_DIR}/seed-hypervisors" "${CNF_INVENTORY_PATH}/group_vars/hypervisors.yaml" | ||
| cp "${SHARED_DIR}/seed-bastions" "${CNF_INVENTORY_PATH}/group_vars/bastions.yaml" | ||
| cp "${SHARED_DIR}/seed-all" "${CNF_INVENTORY_PATH}/group_vars/all.yaml" | ||
| cp "${SHARED_DIR}/seed-bastion" "${CNF_INVENTORY_PATH}/host_vars/bastion.yaml" | ||
| cp "${SHARED_DIR}/seed-master0" "${CNF_INVENTORY_PATH}/host_vars/master-0.yaml" | ||
| cp "${SHARED_DIR}/seed-hypervisor" "${CNF_INVENTORY_PATH}/host_vars/hypervisor.yaml" | ||
| cp "${SHARED_DIR}/masters" "${CNF_INVENTORY_PATH}/group_vars/masters.yaml" | ||
| cp "${SHARED_DIR}/nodes" "${CNF_INVENTORY_PATH}/group_vars/nodes.yaml" | ||
| cp "${SHARED_DIR}/hypervisors" "${CNF_INVENTORY_PATH}/group_vars/hypervisors.yaml" | ||
| cp "${SHARED_DIR}/bastions" "${CNF_INVENTORY_PATH}/group_vars/bastions.yaml" | ||
| cp "${SHARED_DIR}/all" "${CNF_INVENTORY_PATH}/group_vars/all.yaml" | ||
| cp "${SHARED_DIR}/bastion" "${CNF_INVENTORY_PATH}/host_vars/bastion.yaml" | ||
| cp "${SHARED_DIR}/master0" "${CNF_INVENTORY_PATH}/host_vars/master-0.yaml" | ||
| cp "${SHARED_DIR}/hypervisor" "${CNF_INVENTORY_PATH}/host_vars/hypervisor.yaml" | ||
|
|
||
| echo "Inventory copied from SHARED_DIR" | ||
|
|
||
|
|
@@ -56,7 +55,7 @@ echo "=== Step 1: Prepare IBU seed SNO and retrieve kubeconfig ===" | |
| SEED_VM_NAME="master-0.${CLUSTER_NAME}" | ||
|
|
||
| cd /eco-ci-cd | ||
| ansible-playbook playbooks/ran/ibu-prepare-seed-sno.yml \ | ||
| ansible-playbook playbooks/ran/ibu-prepare-spoke-sno.yml \ | ||
| -i "${OCP_DEPLOYMENT_INVENTORY_PATH}/build-inventory.py" \ | ||
| --extra-vars "hub_cluster=${CLUSTER_NAME}" \ | ||
| --extra-vars "spoke_cluster=${SEED_SPOKE_CLUSTER}" \ | ||
|
|
@@ -83,6 +82,33 @@ ansible-playbook playbooks/deploy-run-eco-gotests.yaml \ | |
| --extra-vars 'eco_gotests_tag=latest' \ | ||
| --extra-vars "additional_test_env_variables=\"${ECO_GOTESTS_ENV_VARS}\"" | ||
|
|
||
| echo "Set bastion SSH configuration" | ||
| PROJECT_DIR="/tmp" | ||
| grep ansible_ssh_private_key -A 100 "${CNF_INVENTORY_PATH}/group_vars/all.yaml" | sed 's/ansible_ssh_private_key: //g' | sed "s/'//g" > "${PROJECT_DIR}/temp_ssh_key" | ||
| chmod 600 "${PROJECT_DIR}/temp_ssh_key" | ||
|
|
||
| BASTION_IP=$(grep -oP '(?<=ansible_host: ).*' "${CNF_INVENTORY_PATH}/host_vars/bastion.yaml" | sed "s/'//g") | ||
| BASTION_USER=$(grep -oP '(?<=ansible_user: ).*' "${CNF_INVENTORY_PATH}/group_vars/all.yaml" | sed "s/'//g") | ||
|
|
||
| echo "Run eco-gotests via SSH tunnel" | ||
| ssh -o ServerAliveInterval=60 -o ServerAliveCountMax=3 \ | ||
| -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ | ||
| "${BASTION_USER}@${BASTION_IP}" -i "${PROJECT_DIR}/temp_ssh_key" \ | ||
| "cd /tmp/eco_gotests && ./eco-gotests-run.sh || true" | ||
|
|
||
| echo "Gather artifacts from bastion" | ||
| mkdir -p "${ARTIFACT_DIR}/junit_eco_gotests" | ||
| scp -r -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ | ||
| -i "${PROJECT_DIR}/temp_ssh_key" \ | ||
| "${BASTION_USER}@${BASTION_IP}:/tmp/eco_gotests/report/*.xml" \ | ||
| "${ARTIFACT_DIR}/junit_eco_gotests/" | ||
|
Comment on lines
+99
to
+104
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Handle “no XML reports” separately from real copy failures. The remote test run is intentionally non-blocking ( 🧰 Tools🪛 ast-grep (0.44.0)[warning] 100-103: This (ssh-disable-host-key-check-bash) 🤖 Prompt for AI Agents |
||
| rm -f "${PROJECT_DIR}/temp_ssh_key" | ||
|
|
||
| # Save junit XMLs to SHARED_DIR with junit_ prefix for ibu-report step | ||
| for f in "${ARTIFACT_DIR}/junit_eco_gotests/"*.xml; do | ||
| [[ -f "$f" ]] && cp "$f" "${SHARED_DIR}/junit_ibu_seed_$(basename "$f")" | ||
| done | ||
|
|
||
| echo "" | ||
| echo "=== Step 3: Power off seed spoke VM ===" | ||
| ansible-playbook playbooks/ran/ibu-poweroff-seed-spoke.yml \ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| approvers: | ||
| - ccardenosa | ||
| - eifrach | ||
| - kononovn | ||
| - mkochanowski | ||
| - rdiazcam | ||
| - rdiscala | ||
| - shaior | ||
| - timurmp |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| #!/bin/bash | ||
| set -e | ||
| set -o pipefail | ||
|
|
||
| echo "Checking if the job should be skipped..." | ||
| if [ -f "${SHARED_DIR}/skip.txt" ]; then | ||
| echo "Detected skip.txt file — skipping the job" | ||
| exit 0 | ||
| fi | ||
|
|
||
| OCP_DEPLOYMENT_INVENTORY_PATH="/eco-ci-cd/inventories/ocp-deployment" | ||
| CNF_INVENTORY_PATH="/eco-ci-cd/inventories/cnf" | ||
|
|
||
| echo "=== IBU Upgrade eco-gotests Configuration ===" | ||
| echo "TARGET_CLUSTER_NAME=${TARGET_CLUSTER_NAME}" | ||
| echo "TARGET_SPOKE_CLUSTER=${TARGET_SPOKE_CLUSTER}" | ||
| echo "ECO_GOTESTS_FEATURES=${ECO_GOTESTS_FEATURES}" | ||
| echo "MIRROR_REGISTRY=${MIRROR_REGISTRY}" | ||
| echo "VERSION=${VERSION}" | ||
| echo "" | ||
|
|
||
| # Copy target hub inventory from SHARED_DIR (target-* prefixed files saved by ibu-target-hub-deploy) | ||
| echo "=== Copying target hub inventory from SHARED_DIR ===" | ||
|
|
||
| mkdir -p "${OCP_DEPLOYMENT_INVENTORY_PATH}/group_vars" | ||
| mkdir -p "${OCP_DEPLOYMENT_INVENTORY_PATH}/host_vars" | ||
|
|
||
| cp "${SHARED_DIR}/target-all" "${OCP_DEPLOYMENT_INVENTORY_PATH}/group_vars/all" | ||
| cp "${SHARED_DIR}/target-bastions" "${OCP_DEPLOYMENT_INVENTORY_PATH}/group_vars/bastions" | ||
| cp "${SHARED_DIR}/target-hypervisors" "${OCP_DEPLOYMENT_INVENTORY_PATH}/group_vars/hypervisors" | ||
| cp "${SHARED_DIR}/target-nodes" "${OCP_DEPLOYMENT_INVENTORY_PATH}/group_vars/nodes" | ||
| cp "${SHARED_DIR}/target-masters" "${OCP_DEPLOYMENT_INVENTORY_PATH}/group_vars/masters" | ||
| cp "${SHARED_DIR}/target-bastion" "${OCP_DEPLOYMENT_INVENTORY_PATH}/host_vars/bastion" | ||
| cp "${SHARED_DIR}/target-hypervisor" "${OCP_DEPLOYMENT_INVENTORY_PATH}/host_vars/hypervisor" | ||
| cp "${SHARED_DIR}/target-master0" "${OCP_DEPLOYMENT_INVENTORY_PATH}/host_vars/master0" | ||
|
|
||
| mkdir -p "${CNF_INVENTORY_PATH}/group_vars" | ||
| mkdir -p "${CNF_INVENTORY_PATH}/host_vars" | ||
|
|
||
| cp "${SHARED_DIR}/target-masters" "${CNF_INVENTORY_PATH}/group_vars/masters.yaml" | ||
| cp "${SHARED_DIR}/target-nodes" "${CNF_INVENTORY_PATH}/group_vars/nodes.yaml" | ||
| cp "${SHARED_DIR}/target-hypervisors" "${CNF_INVENTORY_PATH}/group_vars/hypervisors.yaml" | ||
| cp "${SHARED_DIR}/target-bastions" "${CNF_INVENTORY_PATH}/group_vars/bastions.yaml" | ||
| cp "${SHARED_DIR}/target-all" "${CNF_INVENTORY_PATH}/group_vars/all.yaml" | ||
| cp "${SHARED_DIR}/target-bastion" "${CNF_INVENTORY_PATH}/host_vars/bastion.yaml" | ||
| cp "${SHARED_DIR}/target-master0" "${CNF_INVENTORY_PATH}/host_vars/master-0.yaml" | ||
| cp "${SHARED_DIR}/target-hypervisor" "${CNF_INVENTORY_PATH}/host_vars/hypervisor.yaml" | ||
|
|
||
| echo "Target hub inventory copied from SHARED_DIR" | ||
|
|
||
| # Target hub kubeconfig at the standard telcov10n path on the target bastion | ||
| TARGET_HUB_KUBECONFIG="/home/telcov10n/project/generated/${TARGET_CLUSTER_NAME}/auth/kubeconfig" | ||
| TARGET_VM_NAME="master-0.${TARGET_CLUSTER_NAME}" | ||
|
|
||
| echo "" | ||
| echo "=== Step 1: Prepare IBU target SNO and retrieve kubeconfig ===" | ||
|
|
||
| cd /eco-ci-cd | ||
| ansible-playbook playbooks/ran/ibu-prepare-spoke-sno.yml \ | ||
| -i "${OCP_DEPLOYMENT_INVENTORY_PATH}/build-inventory.py" \ | ||
| --extra-vars "hub_cluster=${TARGET_CLUSTER_NAME}" \ | ||
| --extra-vars "spoke_cluster=${TARGET_SPOKE_CLUSTER}" \ | ||
| --extra-vars "seed_vm_name=${TARGET_VM_NAME}" | ||
|
|
||
| echo "" | ||
| echo "=== Step 2: Run eco-gotests IBU upgrade suite ===" | ||
| TARGET_SPOKE_KUBECONFIG="/tmp/${TARGET_SPOKE_CLUSTER}-kubeconfig" | ||
|
|
||
| # Build eco-gotests environment variables | ||
| ECO_GOTESTS_ENV_VARS="-e ECO_CNF_RAN_SKIP_TLS_VERIFY=true" | ||
| ECO_GOTESTS_ENV_VARS+=" -e ECO_LCA_IBGU_SEED_IMAGE=${MIRROR_REGISTRY}/ibu/seed:${VERSION}" | ||
| ECO_GOTESTS_ENV_VARS+=" -e ECO_LCA_IBU_CNF_KUBECONFIG_TARGET_SNO=${TARGET_HUB_KUBECONFIG}" | ||
|
|
||
| ansible-playbook playbooks/deploy-run-eco-gotests.yaml \ | ||
| -i "${CNF_INVENTORY_PATH}/switch-config.yaml" \ | ||
| --extra-vars "kubeconfig=${TARGET_SPOKE_KUBECONFIG}" \ | ||
| --extra-vars "features=${ECO_GOTESTS_FEATURES}" \ | ||
| --extra-vars 'labels=!no-container' \ | ||
| --extra-vars 'eco_worker_label=""' \ | ||
| --extra-vars 'eco_cnf_core_net_switch_user=""' \ | ||
| --extra-vars 'eco_cnf_core_net_switch_pass=""' \ | ||
| --extra-vars 'eco_gotests_tag=latest' \ | ||
| --extra-vars "additional_test_env_variables=\"${ECO_GOTESTS_ENV_VARS}\"" | ||
|
|
||
| echo "Set bastion SSH configuration" | ||
| PROJECT_DIR="/tmp" | ||
| grep ansible_ssh_private_key -A 100 "${CNF_INVENTORY_PATH}/group_vars/all.yaml" | sed 's/ansible_ssh_private_key: //g' | sed "s/'//g" > "${PROJECT_DIR}/temp_ssh_key" | ||
| chmod 600 "${PROJECT_DIR}/temp_ssh_key" | ||
|
|
||
| BASTION_IP=$(grep -oP '(?<=ansible_host: ).*' "${CNF_INVENTORY_PATH}/host_vars/bastion.yaml" | sed "s/'//g") | ||
| BASTION_USER=$(grep -oP '(?<=ansible_user: ).*' "${CNF_INVENTORY_PATH}/group_vars/all.yaml" | sed "s/'//g") | ||
|
|
||
| echo "Run eco-gotests via SSH tunnel" | ||
| ssh -o ServerAliveInterval=60 -o ServerAliveCountMax=3 \ | ||
| -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ | ||
| "${BASTION_USER}@${BASTION_IP}" -i "${PROJECT_DIR}/temp_ssh_key" \ | ||
| "cd /tmp/eco_gotests && ./eco-gotests-run.sh || true" | ||
|
|
||
| echo "Gather artifacts from bastion" | ||
| mkdir -p "${ARTIFACT_DIR}/junit_eco_gotests_upgrade" | ||
| scp -r -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null \ | ||
| -i "${PROJECT_DIR}/temp_ssh_key" \ | ||
| "${BASTION_USER}@${BASTION_IP}:/tmp/eco_gotests/report/*.xml" \ | ||
| "${ARTIFACT_DIR}/junit_eco_gotests_upgrade/" | ||
| rm -f "${PROJECT_DIR}/temp_ssh_key" | ||
|
|
||
| # Save junit XMLs to SHARED_DIR with junit_ prefix for ibu-report step | ||
| for f in "${ARTIFACT_DIR}/junit_eco_gotests_upgrade/"*.xml; do | ||
| [[ -f "$f" ]] && cp "$f" "${SHARED_DIR}/junit_ibu_upgrade_$(basename "$f")" | ||
| done | ||
|
|
||
| echo "" | ||
| echo "=== IBU Upgrade Eco-Gotests Complete ===" | ||
| echo "Seed image: ${MIRROR_REGISTRY}/ibu/seed:${VERSION}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "path": "telcov10n/functional/cnf-ran/ibu-eco-gotests-upgrade/telcov10n-functional-cnf-ran-ibu-eco-gotests-upgrade-ref.yaml", | ||
| "owners": { | ||
| "approvers": [ | ||
| "ccardenosa", | ||
| "eifrach", | ||
| "kononovn", | ||
| "mkochanowski", | ||
| "rdiazcam", | ||
| "rdiscala", | ||
| "shaior", | ||
| "timurmp" | ||
| ] | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| ref: | ||
| as: telcov10n-functional-cnf-ran-ibu-eco-gotests-upgrade | ||
| from_image: | ||
| namespace: telcov10n-ci | ||
| name: eco-ci-cd | ||
| tag: eco-ci-cd | ||
| commands: telcov10n-functional-cnf-ran-ibu-eco-gotests-upgrade-commands.sh | ||
| documentation: |- | ||
| Prepare IBU target SNO and run eco-gotests upgrade suite against the target | ||
| spoke cluster managed by the target hub (kni-qe-109). | ||
|
|
||
| Flow: | ||
| 1. Copy target hub inventory from SHARED_DIR (target-* prefixed files saved | ||
| by ibu-target-hub-deploy) | ||
| 2. Run ibu-prepare-spoke-sno.yml to retrieve the target spoke kubeconfig | ||
| from the target hub ACM | ||
| 3. Run eco-gotests IBU upgrade test suite using the retrieved spoke kubeconfig; | ||
| ECO_LCA_IBU_CNF_KUBECONFIG_TARGET_SNO points to the target hub kubeconfig | ||
| at the standard telcov10n path on the target bastion | ||
|
|
||
| This step runs after the seed image has been mirrored to the target bastion | ||
| and is ready for use in upgrade testing. | ||
| timeout: 90m | ||
| resources: | ||
| requests: | ||
| cpu: 100m | ||
| memory: 200Mi | ||
|
|
||
| env: | ||
| - name: TARGET_CLUSTER_NAME | ||
| default: "kni-qe-109" | ||
| documentation: Target hub cluster name (manages target spoke clusters via ACM) | ||
| - name: TARGET_SPOKE_CLUSTER | ||
| default: "ibu-target" | ||
| documentation: Target spoke SNO cluster name (the cluster being upgraded via IBU) | ||
| - name: ECO_GOTESTS_FEATURES | ||
| default: "upgrade" | ||
| documentation: Space-separated list of eco-gotests features (IBU tests) | ||
| - name: MIRROR_REGISTRY | ||
| default: "disconnected.registry.local:5000" | ||
| documentation: Disconnected mirror registry address for seed image | ||
| - name: VERSION | ||
| default: "4.20" | ||
| documentation: OCP version used to tag the seed image |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| approvers: | ||
| - ccardenosa | ||
| - eifrach | ||
| - kononovn | ||
| - mkochanowski | ||
| - rdiazcam | ||
| - rdiscala | ||
| - shaior | ||
| - timurmp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Stop scraping these inventory YAML files with
grep/sed.grep -A 100only works ifansible_ssh_private_keystays at the end ofgroup_vars/all.yaml; as soon as more top-level keys follow it,temp_ssh_keywill contain trailing YAML and SSH will reject it. Theansible_host/ansible_userlookups have the same brittleness, so this block should use a YAML-aware read instead. The identical block in the new upgrade script needs the same fix.🤖 Prompt for AI Agents