From d91dcbb9362def8fc779db6eb6178802fdb84543 Mon Sep 17 00:00:00 2001 From: Ben Luzarraga Date: Thu, 2 Jul 2026 08:01:15 -0500 Subject: [PATCH 1/5] init 110 patch 1 resources Signed-off-by: Ben Luzarraga --- .../patches/v110-patch1/apply-v110-patch1.sh | 171 ++++++++++++++++++ .../v110-patch1-image-manifest.yaml | 4 + 2 files changed, 175 insertions(+) create mode 100644 scripts/patches/v110-patch1/apply-v110-patch1.sh create mode 100644 scripts/patches/v110-patch1/v110-patch1-image-manifest.yaml diff --git a/scripts/patches/v110-patch1/apply-v110-patch1.sh b/scripts/patches/v110-patch1/apply-v110-patch1.sh new file mode 100644 index 0000000..324a59e --- /dev/null +++ b/scripts/patches/v110-patch1/apply-v110-patch1.sh @@ -0,0 +1,171 @@ +#!/usr/bin/env bash + +set -e + +INSTALL_FOLDER=$1 +MANIFEST=$2 +export WORKSPACE_DIR="./v110-patch1-mirror-workspace" +export VALUES_FILE_DYNAMIC="${INSTALL_FOLDER}/partner-install/mcsp/resources/charts/bootstrap-cd-pipeline/values-dynamic.yaml" +export SECRETS_FILE="${INSTALL_FOLDER}/partner-install/mcsp/resources/charts/bootstrap-cd-pipeline/secrets.yaml" + +# Color codes for output +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' # No Color + +function main() { + + # need to validate parameters + if [ -z "$INSTALL_FOLDER" ]; then + log_error "Install folder not specified. Please rerun script in format: ./apply-v100-patch1.sh " + exit 1 + fi + if [ ! -d "$INSTALL_FOLDER" ]; then + log_error "Error: Install folder $INSTALL_FOLDER does not exist." + exit 1 + fi + + if [ -z "$MANIFEST" ]; then + log_error "Manifest file not specified. Please rerun script in format: ./apply-v100-patch1.sh " + exit 1 + fi + if [ ! -f "$MANIFEST" ]; then + log_error "Error: Manifest file $MANIFEST does not exist." + exit 1 + fi + if [ ! -f "$INSTALL_FOLDER/partner-install/mcsp/resources/charts/bootstrap-cd-pipeline/template.env" ]; then + log_error "Make sure the install folder path points to the SovereignCore directory and re-run" + exit 1 + fi + log_info "Validations passed" + + #source necessary template.env values + source ${INSTALL_FOLDER}/partner-install/mcsp/resources/charts/bootstrap-cd-pipeline/template.env + + # extract variables from values.yaml and secrets.yaml + QUAY_REGISTRY=$(yq -r '.registry.domain // ""' "$VALUES_FILE_DYNAMIC") + QUAY_USERNAME=$(yq -r '.registry.username // ""' "$SECRETS_FILE") + QUAY_PASSWORD=$(yq -r '.registry.password // ""' "$SECRETS_FILE") + QUAY_ORGANIZATION="sovcloud" + CLUSTER_NAME=$(yq -r '.clusterName // ""' "${INSTALL_FOLDER}/config/global.yaml") + + ROOT_DIR=$(yq '.workingDir' "${INSTALL_FOLDER}/config/global.yaml") + export KUBECONFIG="${ROOT_DIR}/ocp-cluster/auth/kubeconfig" + + # need to mirror images based on image manifest file + # call the mirror.sh mirror_images function, directly point it to the manifest file + if mirror_images "$MANIFEST"; then + log_info "Successfully mirrored images from $MANIFEST" + else + log_error "Failed to mirror images from $MANIFEST" + exit 1 + fi + log_info "done mirroring images" + + sync_argo ${CLUSTER_NAME} + + # run cuga argo refresh commands + refresh_argo ${CLUSTER_NAME} +} + +refresh_argo() { + local cluster_name=$1 + + APPS=( + acm-cuga-system-${cluster_name} + agent-service-broker-${cluster_name} + backup-restore-pipelines-${core} + ) + + NS="openshift-gitops" + + for app in "${APPS[@]}"; do + log_info "Refreshing $app" + oc patch application.argoproj.io "$app" -n "$NS" \ + --type merge \ + -p '{"metadata":{"annotations":{"argocd.argoproj.io/refresh":"hard"}}}' + oc annotate application.argoproj.io "$app" -n "$NS" \ + cache-buster="$(date +%s)" --overwrite + done +} + +sync_argo() { + local cluster_name=$1 + + APPS=( + acm-cuga-system-${cluster_name} + agent-service-broker-${cluster_name} + backup-restore-pipelines-${core} + ) + + NS="openshift-gitops" + + for app in "${APPS[@]}"; do + log_info "Syncing $app" + oc patch application.argoproj.io "$app" -n "$NS" \ + --type merge \ + -p '{"operation":{"initiatedBy":{"username":"v110-patch1"},"sync":{"syncStrategy":{"hook":{}}}}}' + done +} + +mirror_images() { + local manifest_file=$1 + local manifest_name=$(basename "$manifest_file" .yaml) + + log_info "==========================================" + log_info "Mirroring images from: $manifest_file" + log_info "==========================================" + + if [ ! -f "$manifest_file" ]; then + log_error "Manifest file not found: $manifest_file" + return 1 + fi + + # Set workspace directory + local workspace_dir="${WORKSPACE_DIR:-./mirror-workspace}" + mkdir -p "$workspace_dir" + + # Get oc-mirror auth file directory + local auth_file_dir="${AUTH_FILE_DIR}" + + # Build the oc-mirror command + local target_registry="docker://${QUAY_REGISTRY}/${QUAY_ORGANIZATION}" + local workspace_path="file://$(realpath $workspace_dir)" + + log_info "Target registry: $target_registry" + log_info "Workspace: $workspace_path" + log_info "" + log_info "Running oc-mirror..." + + # Run oc-mirror + if oc-mirror --v2 --dest-tls-verify=false \ + --authfile "$auth_file_dir" \ + --config "$manifest_file" \ + --retry-times 5 \ + --retry-delay 10s \ + --workspace "$workspace_path" \ + "$target_registry"; then + log_info "✓ Successfully mirrored images from $manifest_name" + + return 0 + else + log_error "✗ Failed to mirror images from $manifest_name" + return 1 + fi +} + +# Function to print colored messages +log_info() { + echo -e "${GREEN}[INFO]${NC} $1" +} + +log_error() { + echo -e "${RED}[ERROR]${NC} $1" +} + +log_warning() { + echo -e "${YELLOW}[WARNING]${NC} $1" +} + +main "$@" \ No newline at end of file diff --git a/scripts/patches/v110-patch1/v110-patch1-image-manifest.yaml b/scripts/patches/v110-patch1/v110-patch1-image-manifest.yaml new file mode 100644 index 0000000..33258a2 --- /dev/null +++ b/scripts/patches/v110-patch1/v110-patch1-image-manifest.yaml @@ -0,0 +1,4 @@ +kind: ImageSetConfiguration +apiVersion: mirror.openshift.io/v2alpha1 +mirror: + additionalImages: \ No newline at end of file From f29d6eeef511860f2c707a3308b83af9d1226da3 Mon Sep 17 00:00:00 2001 From: Ben Luzarraga Date: Thu, 2 Jul 2026 08:13:20 -0500 Subject: [PATCH 2/5] add br microservice Signed-off-by: Ben Luzarraga --- scripts/patches/v110-patch1/apply-v110-patch1.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/patches/v110-patch1/apply-v110-patch1.sh b/scripts/patches/v110-patch1/apply-v110-patch1.sh index 324a59e..ff54097 100644 --- a/scripts/patches/v110-patch1/apply-v110-patch1.sh +++ b/scripts/patches/v110-patch1/apply-v110-patch1.sh @@ -76,6 +76,7 @@ refresh_argo() { acm-cuga-system-${cluster_name} agent-service-broker-${cluster_name} backup-restore-pipelines-${core} + sov-core-k8s-wrapper-${cluster} ) NS="openshift-gitops" @@ -97,6 +98,7 @@ sync_argo() { acm-cuga-system-${cluster_name} agent-service-broker-${cluster_name} backup-restore-pipelines-${core} + sov-core-k8s-wrapper-${cluster} ) NS="openshift-gitops" From bae33eef44358272c199030c5b1740bbf292650b Mon Sep 17 00:00:00 2001 From: Ben Luzarraga Date: Thu, 2 Jul 2026 10:14:18 -0500 Subject: [PATCH 3/5] remove agent-service-broker add acm-vault-aas Signed-off-by: Ben Luzarraga --- scripts/patches/v110-patch1/apply-v110-patch1.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/patches/v110-patch1/apply-v110-patch1.sh b/scripts/patches/v110-patch1/apply-v110-patch1.sh index ff54097..3bd5c05 100644 --- a/scripts/patches/v110-patch1/apply-v110-patch1.sh +++ b/scripts/patches/v110-patch1/apply-v110-patch1.sh @@ -74,9 +74,9 @@ refresh_argo() { APPS=( acm-cuga-system-${cluster_name} - agent-service-broker-${cluster_name} backup-restore-pipelines-${core} sov-core-k8s-wrapper-${cluster} + acm-vault-aas-${cluster} ) NS="openshift-gitops" @@ -96,9 +96,9 @@ sync_argo() { APPS=( acm-cuga-system-${cluster_name} - agent-service-broker-${cluster_name} backup-restore-pipelines-${core} sov-core-k8s-wrapper-${cluster} + acm-vault-aas-${cluster} ) NS="openshift-gitops" From 29249f78b44aebe2215c68cc3e7bc72331b73f75 Mon Sep 17 00:00:00 2001 From: Ben Luzarraga Date: Thu, 2 Jul 2026 15:26:23 -0500 Subject: [PATCH 4/5] updated manifest Signed-off-by: Ben Luzarraga --- .../patches/v110-patch1/v110-patch1-image-manifest.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/patches/v110-patch1/v110-patch1-image-manifest.yaml b/scripts/patches/v110-patch1/v110-patch1-image-manifest.yaml index 33258a2..a7f7a1b 100644 --- a/scripts/patches/v110-patch1/v110-patch1-image-manifest.yaml +++ b/scripts/patches/v110-patch1/v110-patch1-image-manifest.yaml @@ -1,4 +1,9 @@ -kind: ImageSetConfiguration apiVersion: mirror.openshift.io/v2alpha1 +kind: ImageSetConfiguration mirror: - additionalImages: \ No newline at end of file + additionalImages: + - name: cp.icr.io/cp/sovereign-cloud-platform/automation-saas-platform-dev/main/acm-cuga-system:0.2.0@sha256:fe8fffe4eec8e47ef9ef3928b1361e1720da087a8c1a60e08691e68369e10b21 + - name: cp.icr.io/cp/sovereign-cloud-platform/automation-saas-platform-dev/main/acm-vault-aas:0.2.0@sha256:b95436f457e2562b988e017275cf2dbf4451853e466777ff71c179dfb8e50eaa + - name: cp.icr.io/cp/sovereign-cloud-platform/automation-saas-platform-dev/main/backup-restore-pipelines:0.2.0@sha256:b1e8ae431b86e91df0bd7f726a187f382f0f89e2e0fefd1f22993a5395e92fa2 + - name: cp.icr.io/cp/sovereign-cloud-platform/automation-saas-platform-dev/main/sov-core-k8s-wrapper:0.2.0@sha256:9461ef8885ed32737b403d09f06d3502e3aaffd008bb435360078f568af8eb2f + - name: cp.icr.io/cp/sovereign-cloud-platform/automation-saas-platform-dev/sov-core-k8s-wrapper:master-1783011623@sha256:8752d7f4e22061f38d7384f56ee0c311bf673ca1ccb9e27e3445e2c2e8456dd1 \ No newline at end of file From 189eea781e1a98917dd88cd0b79b4fcf04b4b6c9 Mon Sep 17 00:00:00 2001 From: Piotr Godowski Date: Fri, 3 Jul 2026 08:58:39 +0200 Subject: [PATCH 5/5] Fix for 34192 https://github.ibm.com/ibm-saas-platform/workitems/issues/34192 --- .../patches/v110-patch1/apply-v110-patch1.sh | 45 +++++++++++-------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/scripts/patches/v110-patch1/apply-v110-patch1.sh b/scripts/patches/v110-patch1/apply-v110-patch1.sh index 3bd5c05..6c8bf45 100644 --- a/scripts/patches/v110-patch1/apply-v110-patch1.sh +++ b/scripts/patches/v110-patch1/apply-v110-patch1.sh @@ -18,7 +18,7 @@ function main() { # need to validate parameters if [ -z "$INSTALL_FOLDER" ]; then - log_error "Install folder not specified. Please rerun script in format: ./apply-v100-patch1.sh " + log_error "Install folder not specified. Please rerun script in format: ./apply-v110-patch1.sh " exit 1 fi if [ ! -d "$INSTALL_FOLDER" ]; then @@ -27,7 +27,7 @@ function main() { fi if [ -z "$MANIFEST" ]; then - log_error "Manifest file not specified. Please rerun script in format: ./apply-v100-patch1.sh " + log_error "Manifest file not specified. Please rerun script in format: ./apply-v110-patch1.sh " exit 1 fi if [ ! -f "$MANIFEST" ]; then @@ -45,8 +45,6 @@ function main() { # extract variables from values.yaml and secrets.yaml QUAY_REGISTRY=$(yq -r '.registry.domain // ""' "$VALUES_FILE_DYNAMIC") - QUAY_USERNAME=$(yq -r '.registry.username // ""' "$SECRETS_FILE") - QUAY_PASSWORD=$(yq -r '.registry.password // ""' "$SECRETS_FILE") QUAY_ORGANIZATION="sovcloud" CLUSTER_NAME=$(yq -r '.clusterName // ""' "${INSTALL_FOLDER}/config/global.yaml") @@ -74,21 +72,27 @@ refresh_argo() { APPS=( acm-cuga-system-${cluster_name} - backup-restore-pipelines-${core} - sov-core-k8s-wrapper-${cluster} - acm-vault-aas-${cluster} + backup-restore-pipelines-${cluster_name} + sov-core-k8s-wrapper-${cluster_name} + acm-vault-aas-${cluster_name} ) NS="openshift-gitops" + local failed=0 for app in "${APPS[@]}"; do - log_info "Refreshing $app" - oc patch application.argoproj.io "$app" -n "$NS" \ - --type merge \ - -p '{"metadata":{"annotations":{"argocd.argoproj.io/refresh":"hard"}}}' - oc annotate application.argoproj.io "$app" -n "$NS" \ - cache-buster="$(date +%s)" --overwrite + log_info "Refreshing $app" + if ! oc patch application.argoproj.io "$app" -n "$NS" \ + --type merge \ + -p '{"metadata":{"annotations":{"argocd.argoproj.io/refresh":"hard"}}}'; then + log_error "Failed to refresh $app" + failed=1 + continue + fi + oc annotate application.argoproj.io "$app" -n "$NS" \ + cache-buster="$(date +%s)" --overwrite done + return $failed } sync_argo() { @@ -96,19 +100,24 @@ sync_argo() { APPS=( acm-cuga-system-${cluster_name} - backup-restore-pipelines-${core} - sov-core-k8s-wrapper-${cluster} - acm-vault-aas-${cluster} + backup-restore-pipelines-${cluster_name} + sov-core-k8s-wrapper-${cluster_name} + acm-vault-aas-${cluster_name} ) NS="openshift-gitops" + local failed=0 for app in "${APPS[@]}"; do log_info "Syncing $app" - oc patch application.argoproj.io "$app" -n "$NS" \ + if ! oc patch application.argoproj.io "$app" -n "$NS" \ --type merge \ - -p '{"operation":{"initiatedBy":{"username":"v110-patch1"},"sync":{"syncStrategy":{"hook":{}}}}}' + -p '{"operation":{"initiatedBy":{"username":"v110-patch1"},"sync":{"syncStrategy":{"hook":{}}}}}'; then + log_error "Failed to sync $app" + failed=1 + fi done + return $failed } mirror_images() {