-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add target spoke deploy for ibu lane #80770
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?
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 |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| approvers: | ||
| - shaior | ||
| - kononovn | ||
| - eifrach |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| #!/bin/bash | ||
| set -e | ||
| set -o pipefail | ||
|
Comment on lines
+2
to
+3
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. 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win Use
Suggested patch-set -e
-set -o pipefail
+set -euo pipefailAs per coding guidelines, step registry command scripts should use the default 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
|
|
||
| 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 | ||
|
|
||
| INVENTORY_PATH="/eco-ci-cd/inventories/ocp-deployment" | ||
|
|
||
| echo "Create group_vars directory" | ||
| mkdir -p ${INVENTORY_PATH}/group_vars | ||
|
|
||
| echo "Copy target hub group inventory files from SHARED_DIR (target- prefixed)" | ||
| cp ${SHARED_DIR}/target-all ${INVENTORY_PATH}/group_vars/all | ||
| cp ${SHARED_DIR}/target-bastions ${INVENTORY_PATH}/group_vars/bastions | ||
| cp ${SHARED_DIR}/target-hypervisors ${INVENTORY_PATH}/group_vars/hypervisors | ||
| cp ${SHARED_DIR}/target-nodes ${INVENTORY_PATH}/group_vars/nodes | ||
| cp ${SHARED_DIR}/target-masters ${INVENTORY_PATH}/group_vars/masters | ||
|
|
||
| echo "Create host_vars directory" | ||
| mkdir -p ${INVENTORY_PATH}/host_vars | ||
|
|
||
| echo "Copy target hub host inventory files from SHARED_DIR (target- prefixed)" | ||
| cp ${SHARED_DIR}/target-bastion ${INVENTORY_PATH}/host_vars/bastion | ||
| cp ${SHARED_DIR}/target-hypervisor ${INVENTORY_PATH}/host_vars/hypervisor | ||
| cp ${SHARED_DIR}/target-master0 ${INVENTORY_PATH}/host_vars/master0 | ||
|
|
||
| # Kubeconfig lives on the target hub bastion, under the target cluster name | ||
| KUBECONFIG_PATH="/home/telcov10n/project/generated/${TARGET_CLUSTER_NAME}/auth/kubeconfig" | ||
|
|
||
| cd /eco-ci-cd | ||
|
|
||
| echo "Running ZTP deployment for target SNO spoke cluster: ${TARGET_SPOKE_CLUSTER}" | ||
| ansible-playbook ./playbooks/ran/deploy-spoke-sno.yaml \ | ||
| -i ./inventories/ocp-deployment/build-inventory.py \ | ||
| --extra-vars "kubeconfig=${KUBECONFIG_PATH} \ | ||
| spoke_clusters='${TARGET_SPOKE_CLUSTER}' \ | ||
| ztp_git_repo_url=${ZTP_GIT_REPO} \ | ||
| ztp_clusters_git_path=siteconfig/${TARGET_SPOKE_VERSION} \ | ||
| ztp_policies_git_path=policygentemplates/${TARGET_SPOKE_VERSION} \ | ||
| ztp_git_repo_branch=${ZTP_GIT_BRANCH}" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "path": "telcov10n/functional/cnf-ran/ibu-target-deploy-spoke-sno/telcov10n-functional-cnf-ran-ibu-target-deploy-spoke-sno-ref.yaml", | ||
| "owners": { | ||
| "approvers": [ | ||
| "shaior", | ||
| "kononovn", | ||
| "eifrach" | ||
| ] | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| ref: | ||
| as: telcov10n-functional-cnf-ran-ibu-target-deploy-spoke-sno | ||
| from_image: | ||
| namespace: telcov10n-ci | ||
| name: eco-ci-cd | ||
| tag: eco-ci-cd | ||
| commands: telcov10n-functional-cnf-ran-ibu-target-deploy-spoke-sno-commands.sh | ||
| timeout: 5h | ||
| resources: | ||
| requests: | ||
| cpu: 100m | ||
| env: | ||
| - name: TARGET_SPOKE_VERSION | ||
| default: "4.18" | ||
| documentation: >- | ||
| OCP version of the target spoke; must match ztp-site-configs-ci path | ||
| siteconfig/<TARGET_SPOKE_VERSION>/<TARGET_SPOKE_CLUSTER>/ | ||
| - name: TARGET_CLUSTER_NAME | ||
| default: "kni-qe-109" | ||
| documentation: IBU target hub cluster name (used to resolve kubeconfig path on the bastion) | ||
| - name: TARGET_SPOKE_CLUSTER | ||
| default: "" | ||
| documentation: >- | ||
| Target spoke cluster name in JSON array format, e.g. "['ibu-target']". | ||
| Must match the ZTP siteconfig directory name. | ||
| - name: ZTP_GIT_REPO | ||
| default: "https://gitlab.cee.redhat.com/telcov10n/ztp-site-configs-ci.git" | ||
| documentation: ZTP site configs repo | ||
| - name: ZTP_GIT_BRANCH | ||
| default: "main" | ||
| documentation: Branch to use in ztp-site-configs-ci repo | ||
| documentation: |- | ||
| Deploy target SNO spoke cluster via ZTP on the IBU target hub (kni-qe-109). | ||
| Reads target hub inventory from target-* prefixed files in SHARED_DIR saved by | ||
| ibu-target-hub-deploy. These files are unaffected by ibu-restore-seed-inventory and | ||
| are available as soon as ibu-target-hub-deploy completes. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,11 +17,18 @@ mkdir -p /eco-ci-cd/inventories/ocp-deployment/host_vars | |
|
|
||
| cp "${SHARED_DIR}/bastion" /eco-ci-cd/inventories/ocp-deployment/host_vars/bastion | ||
|
|
||
| if [[ -f "${SHARED_DIR}/cluster_name" ]]; then | ||
| CLUSTER_NAME=$(cat "${SHARED_DIR}/cluster_name") | ||
| fi | ||
|
|
||
| KUBECONFIG_PATH="/home/telcov10n/project/generated/${CLUSTER_NAME}/auth/kubeconfig" | ||
|
|
||
|
Comment on lines
+20
to
+25
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. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Verify whether the step ref guarantees CLUSTER_NAME in env.
fd -i 'telcov10n-functional-cnf-ran-ibu-target-mirror-ocp-ref.yaml' ci-operator/step-registry --exec sed -n '1,220p' {}Repository: openshift/release Length of output: 675 🏁 Script executed: cat -n ci-operator/step-registry/telcov10n/functional/cnf-ran/ibu-target-mirror-ocp/telcov10n-functional-cnf-ran-ibu-target-mirror-ocp-commands.shRepository: openshift/release Length of output: 1397 🏁 Script executed: # Search for workflows/chains that use this step
fd -i 'ibu-target-mirror-ocp' ci-operator/step-registry --exec grep -l {} \; 2>/dev/null | head -20Repository: openshift/release Length of output: 43 🏁 Script executed: # Check if CLUSTER_NAME is used elsewhere in similar telcov10n steps
rg 'CLUSTER_NAME' ci-operator/step-registry/telcov10n --type sh -B 2 -A 2 | head -50Repository: openshift/release Length of output: 9914 Validate
Suggested patch if [[ -f "${SHARED_DIR}/cluster_name" ]]; then
CLUSTER_NAME=$(cat "${SHARED_DIR}/cluster_name")
fi
+if [[ -z "${CLUSTER_NAME:-}" ]]; then
+ echo "ERROR: CLUSTER_NAME is empty and ${SHARED_DIR}/cluster_name was not found" >&2
+ exit 1
+fi
+
KUBECONFIG_PATH="/home/telcov10n/project/generated/${CLUSTER_NAME}/auth/kubeconfig"🤖 Prompt for AI Agents |
||
| echo "CLUSTER_NAME=${CLUSTER_NAME}" | ||
| echo "TARGET_SPOKE_VERSION=${TARGET_SPOKE_VERSION}" | ||
|
|
||
| cd /eco-ci-cd | ||
|
|
||
| echo "Mirroring OCP ${TARGET_SPOKE_VERSION} to target hub disconnected registry" | ||
| ansible-playbook ./playbooks/ran/mirror-ocp-release.yml \ | ||
| ansible-playbook ./playbooks/ran/prepare-ocp-release.yml \ | ||
| -i ./inventories/ocp-deployment/build-inventory.py \ | ||
| --extra-vars "release=${TARGET_SPOKE_VERSION}" | ||
| --extra-vars "release=${TARGET_SPOKE_VERSION} kubeconfig=${KUBECONFIG_PATH}" | ||
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.
🧩 Analysis chain
🏁 Script executed:
Repository: openshift/release
Length of output: 594
🏁 Script executed:
cat -n ci-operator/config/openshift-kni/eco-ci-cd/openshift-kni-eco-ci-cd-main__cnf-ran-ibu-4.20.yaml | head -60Repository: openshift/release
Length of output: 6643
🏁 Script executed:
Repository: openshift/release
Length of output: 2188
🏁 Script executed:
Repository: openshift/release
Length of output: 1935
🏁 Script executed:
Repository: openshift/release
Length of output: 594
🏁 Script executed:
Repository: openshift/release
Length of output: 118
🏁 Script executed:
Repository: openshift/release
Length of output: 2805
🏁 Script executed:
Repository: openshift/release
Length of output: 308
Use JSON array syntax for
SPOKE_CLUSTERandTARGET_SPOKE_CLUSTERenvironment variables.The current Python-style list syntax with escaped quotes (
'[''ibu-seed'']') produces invalid JSON when passed to Ansible. After shell parsing, the outer quotes are stripped, leaving[ibu-seed], which fails JSON validation. Ansible expects valid JSON arrays for these variables; use'["ibu-seed"]'instead, which correctly produces["ibu-seed"]after shell parsing.Suggested patch
🤖 Prompt for AI Agents