diff --git a/ci-operator/step-registry/telcov10n/functional/compute-nto/ocp-setup-sno-day0/telcov10n-functional-compute-nto-ocp-setup-sno-day0-workflow.yaml b/ci-operator/step-registry/telcov10n/functional/compute-nto/ocp-setup-sno-day0/telcov10n-functional-compute-nto-ocp-setup-sno-day0-workflow.yaml index aeb63ffba186e..9ee3bc55bd618 100644 --- a/ci-operator/step-registry/telcov10n/functional/compute-nto/ocp-setup-sno-day0/telcov10n-functional-compute-nto-ocp-setup-sno-day0-workflow.yaml +++ b/ci-operator/step-registry/telcov10n/functional/compute-nto/ocp-setup-sno-day0/telcov10n-functional-compute-nto-ocp-setup-sno-day0-workflow.yaml @@ -3,7 +3,7 @@ workflow: steps: pre: - ref: telcov10n-functional-compute-nto-setup-cluster-env - - ref: telcov10n-functional-compute-nto-process-inventory + - ref: telcov10n-functional-compute-nto-process-inventory-sno - ref: telcov10n-functional-compute-nto-config - ref: telcov10n-functional-compute-nto-ocp-deploy-sno - ref: telcov10n-functional-compute-nto-must-gather diff --git a/ci-operator/step-registry/telcov10n/functional/compute-nto/ocp-setup-sno/telcov10n-functional-compute-nto-ocp-setup-sno-workflow.yaml b/ci-operator/step-registry/telcov10n/functional/compute-nto/ocp-setup-sno/telcov10n-functional-compute-nto-ocp-setup-sno-workflow.yaml index 153f8db9077f3..245eb05e0dae6 100644 --- a/ci-operator/step-registry/telcov10n/functional/compute-nto/ocp-setup-sno/telcov10n-functional-compute-nto-ocp-setup-sno-workflow.yaml +++ b/ci-operator/step-registry/telcov10n/functional/compute-nto/ocp-setup-sno/telcov10n-functional-compute-nto-ocp-setup-sno-workflow.yaml @@ -3,12 +3,12 @@ workflow: steps: pre: - ref: telcov10n-functional-compute-nto-setup-cluster-env - - ref: telcov10n-functional-compute-nto-process-inventory + - ref: telcov10n-functional-compute-nto-process-inventory-sno - ref: telcov10n-functional-compute-nto-ocp-deploy-sno - ref: telcov10n-functional-compute-nto-config post: - # - ref: telcov10n-verify-junit-reports - # - ref: telcov10n-functional-compute-nto-html-report + - ref: telcov10n-verify-junit-reports + - ref: telcov10n-functional-compute-nto-html-report - ref: telcov10n-functional-compute-nto-send-slack-notification documentation: |- Single Node OpenShift (SNO) cluster setup for compute-nto testing diff --git a/ci-operator/step-registry/telcov10n/functional/compute-nto/process-inventory-sno/OWNERS b/ci-operator/step-registry/telcov10n/functional/compute-nto/process-inventory-sno/OWNERS new file mode 100644 index 0000000000000..58099b32f98b3 --- /dev/null +++ b/ci-operator/step-registry/telcov10n/functional/compute-nto/process-inventory-sno/OWNERS @@ -0,0 +1,6 @@ +approvers: +- natifridman +- shaior +- kononovn +- eifrach +- ccardenosa \ No newline at end of file diff --git a/ci-operator/step-registry/telcov10n/functional/compute-nto/process-inventory-sno/telcov10n-functional-compute-nto-process-inventory-sno-commands.sh b/ci-operator/step-registry/telcov10n/functional/compute-nto/process-inventory-sno/telcov10n-functional-compute-nto-process-inventory-sno-commands.sh new file mode 100755 index 0000000000000..c40664a1637f5 --- /dev/null +++ b/ci-operator/step-registry/telcov10n/functional/compute-nto/process-inventory-sno/telcov10n-functional-compute-nto-process-inventory-sno-commands.sh @@ -0,0 +1,89 @@ +#!/bin/bash +set -e +set -o pipefail +set -x +MOUNTED_HOST_INVENTORY="/var/host_variables" + +function copy_to_shared_dir() { + if [ -z "$1" ] + then + echo "missing directory to copy" + exit 1 + fi + + echo "copying files to $1..." + for filename in $1/*; do cp $filename "${SHARED_DIR}/$(basename $1)_$(basename $filename)"; done + +} + + +process_inventory() { + local directory="$1" + local dest_file="$2" + + if [ -z "$directory" ]; then + echo "Usage: process_inventory " + return 1 + fi + + if [ ! -d "$directory" ]; then + echo "Error: '$directory' is not a valid directory" + return 1 + fi + + find "$directory" -type f | while IFS= read -r filename; do + if [[ $filename == *"secretsync-vault-source-path"* ]]; then + continue + else + echo "$(basename "${filename}")": \'"$(cat "$filename")"\' + fi + done > "${dest_file}" + + echo "Processing complete. Check \"${dest_file}\"" +} + +main() { + + echo "Set CLUSTER_NAME env var" + if [[ -f "${SHARED_DIR}/cluster_name" ]]; then + CLUSTER_NAME=$(cat "${SHARED_DIR}/cluster_name") + fi + export CLUSTER_NAME=${CLUSTER_NAME} + echo CLUSTER_NAME="${CLUSTER_NAME}" + + echo "Create group_vars directory" + mkdir -pv /eco-ci-cd/inventories/ocp-deployment/group_vars + + find /var/group_variables/common/ -mindepth 1 -type d | while read -r dir; do + echo "Process group inventory file: ${dir}" + process_inventory "$dir" /eco-ci-cd/inventories/ocp-deployment/group_vars/"$(basename "${dir}")" + done + + find /var/group_variables/"${CLUSTER_NAME}"/ -mindepth 1 -type d | while read -r dir; do + echo "Process group inventory file: ${dir}" + process_inventory "$dir" /eco-ci-cd/inventories/ocp-deployment/group_vars/"$(basename "${dir}")" + done + + echo "Create host_vars directory" + mkdir -pv /eco-ci-cd/inventories/ocp-deployment/host_vars + + mkdir -pv /tmp/"${CLUSTER_NAME}" + cp -r "${MOUNTED_HOST_INVENTORY}/${CLUSTER_NAME}/hypervisor" /tmp/"${CLUSTER_NAME}"/hypervisor + cp -r "${MOUNTED_HOST_INVENTORY}/${CLUSTER_NAME}/"* /tmp/"${CLUSTER_NAME}"/ + ls -l /tmp/"${CLUSTER_NAME}"/ + MOUNTED_HOST_INVENTORY="/tmp" + + find ${MOUNTED_HOST_INVENTORY}/"${CLUSTER_NAME}"/ -mindepth 1 -type d | while read -r dir; do + echo "Process group inventory file: ${dir}" + process_inventory "$dir" /eco-ci-cd/inventories/ocp-deployment/host_vars/"$(basename "${dir}")" + done + + echo "Store inventory in SHARED_DIR" + copy_to_shared_dir /eco-ci-cd/inventories/ocp-deployment/host_vars + copy_to_shared_dir /eco-ci-cd/inventories/ocp-deployment/group_vars + + echo "Flag process-inventory as completed" + touch "${SHARED_DIR}/process-inventory-completed" +} + +main diff --git a/ci-operator/step-registry/telcov10n/functional/compute-nto/process-inventory-sno/telcov10n-functional-compute-nto-process-inventory-sno-ref.metadata.json b/ci-operator/step-registry/telcov10n/functional/compute-nto/process-inventory-sno/telcov10n-functional-compute-nto-process-inventory-sno-ref.metadata.json new file mode 100644 index 0000000000000..4bf14c0f32686 --- /dev/null +++ b/ci-operator/step-registry/telcov10n/functional/compute-nto/process-inventory-sno/telcov10n-functional-compute-nto-process-inventory-sno-ref.metadata.json @@ -0,0 +1,12 @@ +{ + "path": "telcov10n/functional/compute-nto/process-inventory-sno/telcov10n-functional-compute-nto-process-inventory-sno-ref.yaml", + "owners": { + "approvers": [ + "natifridman", + "shaior", + "kononovn", + "eifrach", + "ccardenosa" + ] + } +} \ No newline at end of file diff --git a/ci-operator/step-registry/telcov10n/functional/compute-nto/process-inventory-sno/telcov10n-functional-compute-nto-process-inventory-sno-ref.yaml b/ci-operator/step-registry/telcov10n/functional/compute-nto/process-inventory-sno/telcov10n-functional-compute-nto-process-inventory-sno-ref.yaml new file mode 100644 index 0000000000000..11ac65c32a0b0 --- /dev/null +++ b/ci-operator/step-registry/telcov10n/functional/compute-nto/process-inventory-sno/telcov10n-functional-compute-nto-process-inventory-sno-ref.yaml @@ -0,0 +1,75 @@ +ref: + as: telcov10n-functional-compute-nto-process-inventory-sno + from_image: + namespace: telcov10n-ci + name: eco-ci-cd + tag: eco-ci-cd + commands: telcov10n-functional-compute-nto-process-inventory-sno-commands.sh + resources: + requests: + cpu: 100m + env: + - name: VERSION + default: "4.18" + documentation: OCP version to deploy + - name: CLUSTER_NAME + default: "" + documentation: BM Cluster name for SNO deployment + - name: OCP_VERSION_RELEASE_TYPE + default: "stable" + documentation: OCP release type (nightly, engineering-candidate, release-candidate, stable) + - name: OCP_VERSION_RELEASE_AGE_MAX_DAYS + default: "365" + documentation: |- + Maximum age in days for OCP release (default: 365 days) + - name: DISCONNECTED + default: "false" + documentation: Enable disconnected installation mode (boolean) + - name: IPV4_ONLY + default: "false" + documentation: Enable IPv4-only cluster configuration (boolean) + - name: IPV6_ONLY + default: "false" + documentation: Enable IPv6-only cluster configuration (boolean) + credentials: + - namespace: test-credentials + name: telcov10n-ansible-group-all + mount_path: /var/group_variables/common/all + - namespace: test-credentials + name: telcov10n-ansible-group-bastions + mount_path: /var/group_variables/common/bastions + - namespace: test-credentials + name: telcov10n-ansible-group-hypervisors + mount_path: /var/group_variables/common/hypervisors + - namespace: test-credentials + name: telcov10n-ansible-group-hlxcl51-sno-masters + mount_path: /var/group_variables/hlxcl51-sno/masters + - namespace: test-credentials + name: telcov10n-ansible-group-hlxcl51-sno-nodes + mount_path: /var/group_variables/hlxcl51-sno/nodes + - namespace: test-credentials + name: telcov10n-ansible-hlxcl51-sno-bastion + mount_path: /var/host_variables/hlxcl51-sno/bastion + - namespace: test-credentials + name: telcov10n-ansible-hlxcl51-sno-master0 + mount_path: /var/host_variables/hlxcl51-sno/master0 + - namespace: test-credentials + name: telcov10n-ansible-hypervisors-ocp-hlxcl51 + mount_path: /var/host_variables/hlxcl51-sno/hypervisor + - namespace: test-credentials + name: telcov10n-ansible-group-hlxcl52-sno-masters + mount_path: /var/group_variables/hlxcl52-sno/masters + - namespace: test-credentials + name: telcov10n-ansible-group-hlxcl52-sno-nodes + mount_path: /var/group_variables/hlxcl52-sno/nodes + - namespace: test-credentials + name: telcov10n-ansible-hlxcl52-sno-bastion + mount_path: /var/host_variables/hlxcl52-sno/bastion + - namespace: test-credentials + name: telcov10n-ansible-hlxcl52-sno-master0 + mount_path: /var/host_variables/hlxcl52-sno/master0 + - namespace: test-credentials + name: telcov10n-ansible-hypervisors-ocp-hlxcl52 + mount_path: /var/host_variables/hlxcl52-sno/hypervisor + +