Skip to content
Open
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 @@ -48,9 +48,19 @@ main() {

if [[ "${GENERATE_HUB_LOCKDOWN:-false}" == "true" ]]; then
echo "Hub lockdown generation enabled"
local timestamp
timestamp=$(date -u +%Y%m%d_%H%M%S)
local lockdown_filename="lockdown-hub-temp-${timestamp}-${BUILD_ID:-0}-prow.json"
# hub_lockdown_output_file must be a path valid on the bastion (tasks run via SSH
# there). /tmp avoids any container-path or ARTIFACT_DIR availability issues.
extra_vars+=(-e "generate_hub_lockdown=true")
extra_vars+=(-e "hub_cluster=${HUB_CLUSTER}")
extra_vars+=(-e "architecture=${ARCHITECTURE:-x86_64}")
extra_vars+=(-e "hub_lockdown_output_file=/tmp/${lockdown_filename}")
Comment thread
coderabbitai[bot] marked this conversation as resolved.
# In lockdown-validation mode (HUB_LOCKDOWN_URI set) architecture is extracted
# from the lockdown JSON — do not override it here.
if [[ -z "${HUB_LOCKDOWN_URI:-}" ]]; then
extra_vars+=(-e "architecture=${ARCHITECTURE:-x86_64}")
fi
fi

ansible-playbook ./playbooks/telco-kpis/deploy-ocp-operators.yml \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,24 @@ main() {
exit 1
fi

local images_file="/tmp/mirror-images-extra-vars.json"
python3 -c "
import json, sys
# Build the images list and base64-encode it so it survives -e quoting intact.
# The playbook decodes with: images_b64 | b64decode | from_json
local images_b64
images_b64=$(python3 -c "
import json, sys, base64
raw = json.loads(sys.argv[1])
source_images = raw.get('images', [])
result = []
for src in source_images:
name_tag = src.rsplit('/', 1)[-1]
result.append({'source': src, 'dest': 'ran-test/' + name_tag})
with open(sys.argv[2], 'w') as f:
json.dump({'images': result}, f)
print(f'Mirroring {len(result)} image(s)')
" "${RAN_IMAGES}" "${images_file}"
print(f'Mirroring {len(result)} image(s)', file=sys.stderr)
print(base64.b64encode(json.dumps(result).encode()).decode())
" "${RAN_IMAGES}")

ansible-playbook ./playbooks/telco-kpis/mirror-images.yml \
-i ./inventories/ocp-deployment/build-inventory.py \
-e "@${images_file}" \
-e "images_b64=${images_b64}" \
-e "registry_host=disconnected.registry.local" \
${DEBUG_FLAG}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,21 @@ main() {

if [[ "${GENERATE_SPOKE_LOCKDOWN:-false}" == "true" ]]; then
echo "Spoke lockdown generation enabled"
extra_vars+=(-e "generate_spoke_lockdown=true")
local timestamp
timestamp=$(date -u +%Y%m%d_%H%M%S)
local lockdown_filename="lockdown-spoke-${VERSION:-unknown}-${ARCHITECTURE:-x86_64}-${timestamp}-${BUILD_ID:-0}-prow.json"
# lockdown_output_file is what the playbook checks to trigger generation:
# ocp_operator_mirror_generate_lockdown: "{{ (lockdown_output_file | default('') | length > 0) }}"
# Write to /tmp on the bastion (tasks run via SSH there, not inside the container).
extra_vars+=(-e "lockdown_output_file=/tmp/${lockdown_filename}")
extra_vars+=(-e "hub_name=${HUB_CLUSTER}")
extra_vars+=(-e "architecture=${ARCHITECTURE:-x86_64}")
# Prow exposes BUILD_ID; use it as build_number for lockdown metadata.
extra_vars+=(-e "build_number=${BUILD_ID:-0}")
# In lockdown-validation mode (SPOKE_LOCKDOWN_URI set) architecture is extracted
# from the lockdown JSON — do not override it here.
if [[ -z "${SPOKE_LOCKDOWN_URI:-}" ]]; then
extra_vars+=(-e "architecture=${ARCHITECTURE:-x86_64}")
fi
fi

ansible-playbook ./playbooks/telco-kpis/mirror-spoke-operators.yml \
Expand Down