Skip to content
This repository was archived by the owner on Sep 9, 2026. It is now read-only.
Merged
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
23 changes: 17 additions & 6 deletions scripts/prepare-fulfillment-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ INSTALLER_KUSTOMIZE_OVERLAY=${INSTALLER_KUSTOMIZE_OVERLAY:-"development"}
INSTALLER_NAMESPACE=${INSTALLER_NAMESPACE:-$(grep "^namespace:" "overlays/${INSTALLER_KUSTOMIZE_OVERLAY}/kustomization.yaml" | awk '{print $2}')}
[[ -z "${INSTALLER_NAMESPACE}" ]] && echo "ERROR: Could not determine namespace from overlays/${INSTALLER_KUSTOMIZE_OVERLAY}/kustomization.yaml" && exit 1
INSTALLER_VM_TEMPLATE=${INSTALLER_VM_TEMPLATE:-}
INSTALLER_CLUSTER_TEMPLATE=${INSTALLER_CLUSTER_TEMPLATE:-}

# Create hub access kubeconfig
./scripts/create-hub-access-kubeconfig.sh
Expand All @@ -23,7 +24,7 @@ FULFILLMENT_INTERNAL_API_URL=https://$(oc get route -n ${INSTALLER_NAMESPACE} fu
osac login --insecure --private --token-script "oc create token -n ${INSTALLER_NAMESPACE} admin" --address ${FULFILLMENT_INTERNAL_API_URL}
osac create hub --kubeconfig=/tmp/kubeconfig.hub-access --id hub --namespace ${INSTALLER_NAMESPACE}

if [[ -n "${INSTALLER_VM_TEMPLATE}" ]]; then
if [[ -n "${INSTALLER_VM_TEMPLATE}" || -n "${INSTALLER_CLUSTER_TEMPLATE}" ]]; then
# Trigger a one-time publish-templates AAP job
AAP_ROUTE_HOST=$(oc get routes -n "${INSTALLER_NAMESPACE}" --no-headers osac-aap -o jsonpath='{.spec.host}')
AAP_URL="https://${AAP_ROUTE_HOST}"
Expand All @@ -40,9 +41,19 @@ if [[ -n "${INSTALLER_VM_TEMPLATE}" ]]; then
exit 1
}

echo "Waiting for computeinstancetemplate ${INSTALLER_VM_TEMPLATE} to be published..."
retry_until 300 5 '[[ -n "$(osac get computeinstancetemplate -o json | jq -r --arg tpl "$INSTALLER_VM_TEMPLATE" '"'"'select(.id == $tpl)'"'"' 2> /dev/null)" ]]' || {
echo "Timed out waiting for computeinstancetemplate to exist"
exit 1
}
if [[ -n "${INSTALLER_VM_TEMPLATE}" ]]; then
echo "Waiting for computeinstancetemplate ${INSTALLER_VM_TEMPLATE} to be published..."
retry_until 300 5 '[[ -n "$(osac get computeinstancetemplate -o json | jq -r --arg tpl "$INSTALLER_VM_TEMPLATE" '"'"'select(.id == $tpl)'"'"' 2> /dev/null)" ]]' || {
echo "Timed out waiting for computeinstancetemplate to exist"
exit 1
}
fi

if [[ -n "${INSTALLER_CLUSTER_TEMPLATE}" ]]; then
echo "Waiting for clustertemplate ${INSTALLER_CLUSTER_TEMPLATE} to be published..."
retry_until 300 5 '[[ -n "$(osac get clustertemplate -o json | jq -r --arg tpl "$INSTALLER_CLUSTER_TEMPLATE" '"'"'select(.id == $tpl)'"'"' 2> /dev/null)" ]]' || {
echo "Timed out waiting for clustertemplate to exist"
exit 1
}
fi
fi
Loading