Skip to content

Commit 96f6cae

Browse files
authored
Add mirrors in ImageContentSourcePolicy and ImageMirrorSet for next SO version too (#3762)
* Add mirrors in ImageContentSourcePolicy and ImageMirrorSet for next SO version too * Run make generated-files
1 parent efba918 commit 96f6cae

File tree

5 files changed

+64
-57
lines changed

5 files changed

+64
-57
lines changed

hack/generate/catalog.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,4 @@ logger.info "Generating ImageContextSourcePolicy"
197197

198198
default_serverless_operator_images
199199
# shellcheck disable=SC2154
200-
create_image_content_source_policy "${INDEX_IMAGE}" "$registry_redhat_io" "$registry_quay" "$registry_quay_previous" "olm-catalog/serverless-operator-index/image_content_source_policy.yaml" ".tekton/images-mirror-set.yaml"
200+
create_image_content_source_policy "${INDEX_IMAGE}" "$registry_redhat_io" "$registry_quay" "$registry_quay_previous" "$registry_quay_next" "olm-catalog/serverless-operator-index/image_content_source_policy.yaml" ".tekton/images-mirror-set.yaml"

hack/lib/catalogsource.bash

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function install_catalogsource {
8484
# Use ImageContentSourcePolicy only with the FBC from Konflux as
8585
# updating machine config pools takes a while.
8686
# shellcheck disable=SC2154
87-
create_image_content_source_policy "$index_image" "$registry_redhat_io" "$registry_quay" "$registry_quay_previous" "$tmpfile" "$idms_tmpfile"
87+
create_image_content_source_policy "$index_image" "$registry_redhat_io" "$registry_quay" "$registry_quay_previous" "$registry_quay_next" "$tmpfile" "$idms_tmpfile"
8888
[ -n "$OPENSHIFT_CI" ] && cat "$tmpfile"
8989
if oc apply -f "$tmpfile"; then
9090
echo "Wait for machineconfigpool update to start"
@@ -125,8 +125,9 @@ function create_image_content_source_policy {
125125
registry_source="${2:?Pass source registry arg[2]}"
126126
registry_target="${3:?Pass target registry arg[3]}"
127127
registry_target_previous="${4:?Pass previous target registry arg[4]}"
128-
image_content_source_policy_output_file="${5:?Pass output file arg[5]}"
129-
image_digest_mirror_output_file="${6:?Pass image_digest_mirror_output_file arg[6]}"
128+
registry_target_next="${5:?Pass next target registry arg[5]}"
129+
image_content_source_policy_output_file="${6:?Pass output file arg[6]}"
130+
image_digest_mirror_output_file="${7:?Pass image_digest_mirror_output_file arg[7]}"
130131

131132
logger.info "Install ImageContentSourcePolicy"
132133
cat > "$image_content_source_policy_output_file" <<EOF
@@ -181,31 +182,32 @@ EOF
181182

182183
local mirror1="${registry_target}/${target_img}"
183184
local mirror2="${registry_target_previous}/${target_img}"
185+
local mirror3="${registry_target_next}/${target_img}"
184186

185-
add_repository_digest_mirrors "$image_content_source_policy_output_file" "${registry_source}/${img}" "${mirror1}" "${mirror2}"
186-
add_image_digest_mirrors "$image_digest_mirror_output_file" "${registry_source}/${img}" "${mirror1}" "${mirror2}"
187+
add_repository_digest_mirrors "$image_content_source_policy_output_file" "${registry_source}/${img}" "${mirror1}" "${mirror2}" "${mirror3}"
188+
add_image_digest_mirrors "$image_digest_mirror_output_file" "${registry_source}/${img}" "${mirror1}" "${mirror2}" "${mirror3}"
187189
fi
188190
done <<< "$mirrors"
189191
}
190192

191193
function add_repository_digest_mirrors {
192-
echo "Add mirror image to '${1}' - $2 = $3, $4"
194+
echo "Add mirror image to '${1}' - $2 = $3, $4, $5"
193195
cat << EOF | yq write --inplace --script - "$1"
194196
- command: update
195197
path: spec.repositoryDigestMirrors[+]
196198
value:
197-
mirrors: [ "${3}", "${4}" ]
199+
mirrors: [ "${3}", "${4}", "${5}" ]
198200
source: "${2}"
199201
EOF
200202
}
201203

202204
function add_image_digest_mirrors {
203-
echo "Add mirror image to '${1}' - $2 = $3, $4"
205+
echo "Add mirror image to '${1}' - $2 = $3, $4, $5"
204206
cat << EOF | yq write --inplace --script - "$1"
205207
- command: update
206208
path: spec.imageDigestMirrors[+]
207209
value:
208-
mirrors: [ "${3}", "${4}" ]
210+
mirrors: [ "${3}", "${4}", "${5}" ]
209211
source: "${2}"
210212
EOF
211213
}

hack/lib/images.bash

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,13 @@ quay_registry_app_version=${quay_registry_app_version%.*} # 136.0 -> 136
1818
quay_registry_app_version_previous=${PREVIOUS_VERSION/./} # 1.35.0 -> 135.0
1919
quay_registry_app_version_previous=${quay_registry_app_version_previous%.*} # 135.0 -> 135
2020

21+
quay_registry_app_version_next=${CURRENT_VERSION/./} # 1.36.0 -> 136.0
22+
quay_registry_app_version_next=${quay_registry_app_version_next%.*} # 136.0 -> 136
23+
quay_registry_app_version_next="$((quay_registry_app_version_next + 1))" # 136 -> 137
24+
2125
export registry_quay="${registry_prefix_quay}${quay_registry_app_version}"
2226
export registry_quay_previous="${registry_prefix_quay}${quay_registry_app_version_previous}"
27+
export registry_quay_next="${registry_prefix_quay}${quay_registry_app_version_next}"
2328
export registry_redhat_io="registry.redhat.io/openshift-serverless-1"
2429

2530
export FORCE_USE_QUAY_IMAGES=${FORCE_USE_QUAY_IMAGES:-"false"}

olm-catalog/serverless-operator-index/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN /bin/opm init serverless-operator --default-channel=stable --output yaml >>
1414
RUN /bin/opm render --skip-tls-verify -o yaml \
1515
quay.io/redhat-user-workloads/ocp-serverless-tenant/serverless-operator-135/serverless-bundle:1.35.0 \
1616
quay.io/redhat-user-workloads/ocp-serverless-tenant/serverless-operator-136/serverless-bundle:1.36.0 \
17-
quay.io/redhat-user-workloads/ocp-serverless-tenant/serverless-operator-137/serverless-bundle@sha256:3ffc5452a37202785df30d54a9c792868f541f4b9e4971a68f5183c701abddab >> /configs/index.yaml
17+
quay.io/redhat-user-workloads/ocp-serverless-tenant/serverless-operator-137/serverless-bundle@sha256:a081d2ca1c4825e3326e2be37e29deb84186c812d2877771a4e86580a9f5024c >> /configs/index.yaml
1818

1919
# The base image is expected to contain
2020
# /bin/opm (with a serve subcommand) and /bin/grpc_health_probe

0 commit comments

Comments
 (0)