diff --git a/devspaces-operator-bundle/build/scripts/sync-che-olm.sh b/devspaces-operator-bundle/build/scripts/sync-che-olm.sh index 10771b1cbe..f99449eae2 100755 --- a/devspaces-operator-bundle/build/scripts/sync-che-olm.sh +++ b/devspaces-operator-bundle/build/scripts/sync-che-olm.sh @@ -96,19 +96,9 @@ UDI_IMAGE="registry.redhat.io/devspaces/udi-rhel8@${UDI_IMAGE_TAG}" RBAC_PROXY_IMAGE="registry.redhat.io/openshift4/ose-kube-rbac-proxy:${OPENSHIFT_TAG}" OAUTH_PROXY_IMAGE="registry.redhat.io/openshift4/ose-oauth-proxy:${OPENSHIFT_TAG}" -CODE_IMAGE_VERSION_ZZZ=$(skopeo inspect docker://quay.io/devspaces/code-rhel8:${DS_VERSION} | yq -r '.RepoTags' | sort -uV | grep "${DS_VERSION}-" | grep -E -v "\.[0-9]{10}" | tr -d '", ' | tail -1) -CODE_IMAGE_DIGEST=$(skopeo inspect docker://quay.io/devspaces/code-rhel8:${CODE_IMAGE_VERSION_ZZZ} | yq -r '.Digest') -CODE_IMAGE="registry.redhat.io/devspaces/code-rhel8@${CODE_IMAGE_DIGEST}" -IDEA_IMAGE_VERSION_ZZZ=$(skopeo inspect docker://quay.io/devspaces/idea-rhel8:${DS_VERSION} | yq -r '.RepoTags' | sort -uV | grep "${DS_VERSION}-" | grep -E -v "\.[0-9]{10}" | tr -d '", ' | tail -1) -IDEA_IMAGE_DIGEST=$(skopeo inspect docker://quay.io/devspaces/idea-rhel8:${IDEA_IMAGE_VERSION_ZZZ} | yq -r '.Digest') -IDEA_IMAGE="registry.redhat.io/devspaces/idea-rhel8@${IDEA_IMAGE_DIGEST}" - -EDITORS_DEFINITIONS_ENV_VAR="[ -{ name: \"RELATED_IMAGE_editor_definition_che_idea_2022_1_idea_rhel8\", value: \"${UDI_IMAGE}\"}, -{ name: \"RELATED_IMAGE_editor_definition_che_idea_2022_1_idea_rhel8_injector\", value: \"${IDEA_IMAGE}\"}, -{ name: \"RELATED_IMAGE_editor_definition_che_code_latest_che_code_runtime_description\", value: \"${UDI_IMAGE}\"}, -{ name: \"RELATED_IMAGE_editor_definition_che_code_latest_che_code_injector\", value: \"${CODE_IMAGE}\"} -]" +UDI_IMAGE_WITH_TAG="${DS_RRIO}/udi-rhel8:${DS_VERSION}" +CODE_IMAGE_WITH_TAG="${DS_RRIO}/code-rhel8:${DS_VERSION}" +IDEA_IMAGE_WITH_TAG="${DS_RRIO}/idea-rhel8:${DS_VERSION}" # header to reattach to yaml files after yq transform removes it COPYRIGHT="# @@ -364,6 +354,22 @@ for CSVFILE in ${TARGETDIR}/manifests/devspaces.csv.yaml; do done echo "Converted (yq #2) ${CSVFILE}" + # Update editors definitions environment variables in csv + # by removing upstream values and inserting downstream ones + # https://github.com/eclipse-che/che/issues/22932 + yq -riY "del(.spec.install.spec.deployments[].spec.template.spec.containers[0].env[] | select(.name | test(\"^RELATED_IMAGE_editor_definition_\")))" "${CSVFILE}" + declare -A operator_insertion=( + ["RELATED_IMAGE_editor_definition_che_idea_2022_1_idea_rhel8"]="${UDI_IMAGE_WITH_TAG}" + ["RELATED_IMAGE_editor_definition_che_idea_2022_1_idea_rhel8_injector"]="${IDEA_IMAGE_WITH_TAG}" + ["RELATED_IMAGE_editor_definition_che_code_latest_che_code_runtime_description"]="${UDI_IMAGE_WITH_TAG}" + ["RELATED_IMAGE_editor_definition_che_code_latest_che_code_injector"]="${CODE_IMAGE_WITH_TAG}" + ) + for updateName in "${!operator_insertion[@]}"; do + env="{name: \"${updateName}\", value: \"${operator_insertion[$updateName]}\"}" + yq -riY "(.spec.install.spec.deployments[].spec.template.spec.containers[0].env ) += [${env}]" "${CSVFILE}" + done + echo "Converted (yq #3) ${CSVFILE}" + # insert replaces: field declare -A spec_insertions=( [".spec.replaces"]="devspacesoperator.v${CSV_VERSION_PREV}" @@ -377,13 +383,7 @@ for CSVFILE in ${TARGETDIR}/manifests/devspaces.csv.yaml; do updateVal="${spec_insertions[$updateName]}" replaceField "${CSVFILE}" "${updateName}" "${updateVal}" "${COPYRIGHT}" done - echo "Converted (yq #3) ${CSVFILE}" - - # https://github.com/eclipse-che/che/issues/22932 - # Update editors definitions environment variables in csv - yq -riY "del(.spec.install.spec.deployments[].spec.template.spec.containers[0].env[] | select(.name | test(\"^RELATED_IMAGE_editor_definition_\")))" "${CSVFILE}" - yq -riY "(.spec.install.spec.deployments[].spec.template.spec.containers[0].env ) += [${EDITORS_DEFINITIONS_ENV_VAR}]" "${CSVFILE}" - echo "Converted (yq #3) ${CSVFILE}" + echo "Converted (yq #4) ${CSVFILE}" # add more RELATED_IMAGE_ fields for the images referenced by the registries bash -e "${SCRIPTS_DIR}/insert-related-images-to-csv.sh" -v "${CSV_VERSION}" -t "${TARGETDIR}" --ds-branch "${MIDSTM_BRANCH}" diff --git a/devspaces-operator/build/scripts/sync-che-operator.sh b/devspaces-operator/build/scripts/sync-che-operator.sh index c0d335ab49..27cfb3701b 100755 --- a/devspaces-operator/build/scripts/sync-che-operator.sh +++ b/devspaces-operator/build/scripts/sync-che-operator.sh @@ -70,10 +70,10 @@ OAUTH_PROXY_IMAGE="registry.redhat.io/openshift4/ose-oauth-proxy:${OPENSHIFT_TAG CODE_IMAGE_VERSION_ZZZ=$(skopeo inspect docker://quay.io/devspaces/code-rhel8:${DS_VERSION} | yq -r '.RepoTags' | sort -uV | grep -v "source" | grep "${DS_VERSION}-" | grep -E -v "\.[0-9]{10}" | tr -d '", ' | tail -1) CODE_IMAGE_DIGEST=$(skopeo inspect docker://quay.io/devspaces/code-rhel8:${CODE_IMAGE_VERSION_ZZZ} | yq -r '.Digest') -CODE_IMAGE="registry.redhat.io/devspaces/code-rhel8@${CODE_IMAGE_DIGEST}" +CODE_IMAGE="${DS_RRIO}/code-rhel8@${CODE_IMAGE_DIGEST}" IDEA_IMAGE_VERSION_ZZZ=$(skopeo inspect docker://quay.io/devspaces/idea-rhel8:${DS_VERSION} | yq -r '.RepoTags' | sort -uV | grep "${DS_VERSION}-" | grep -E -v "\.[0-9]{10}" | tr -d '", ' | tail -1) IDEA_IMAGE_DIGEST=$(skopeo inspect docker://quay.io/devspaces/idea-rhel8:${IDEA_IMAGE_VERSION_ZZZ} | yq -r '.Digest') -IDEA_IMAGE="registry.redhat.io/devspaces/idea-rhel8@${IDEA_IMAGE_DIGEST}" +IDEA_IMAGE="${DS_RRIO}/idea-rhel8@${IDEA_IMAGE_DIGEST}" # global / generic changes pushd "${SOURCEDIR}" >/dev/null