Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
approvers:
- natifridman
- shaior
- kononovn
- eifrach
- ccardenosa
Original file line number Diff line number Diff line change
@@ -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 <directory> <dest_file>"
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
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
Original file line number Diff line number Diff line change
@@ -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