Skip to content

Commit

Permalink
feat: Improve prepare-restricted-environment.sh script not to uploa…
Browse files Browse the repository at this point in the history
…d unnecessary images (#2400)

* feat: add  flag to run  script

Signed-off-by: Anatolii Bazko <[email protected]>

* feat: Improve prepare-restricted-environment.sh script not to upload unnecessary images

Signed-off-by: Anatolii Bazko <[email protected]>

* Fixups

Signed-off-by: Anatolii Bazko <[email protected]>

* Update modules/administration-guide/partials/snip_preparing-images-for-a-restricted-environment.adoc

Co-authored-by: Max Leonov <[email protected]>

Co-authored-by: Max Leonov <[email protected]>
  • Loading branch information
tolusha and max-cx authored Jul 22, 2022
1 parent 44fbf93 commit e9b70be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ declare devworkspace_operator_index="${devworkspace_operator_index:?Define the v
declare devworkspace_operator_package_name="devworkspace-operator"
declare devworkspace_operator_version="${devworkspace_operator_version:?Define the variable}"
declare prod_operator_index="${prod_operator_index:?Define the variable}"
declare prod_operator_bundle_name="${prod_operator_bundle_name:?Define the variable}"
declare prod_operator_package_name="${prod_operator_package_name:?Define the variable}"
declare prod_operator_version="${prod_operator_version:?Define the variable}"

Expand All @@ -46,24 +45,18 @@ mkdir -p "${my_catalog}/${devworkspace_operator_package_name}" "${my_catalog}/${
echo "Fetching metadata for the ${devworkspace_operator_package_name} operator catalog channel, packages, and bundles."
opm render "${devworkspace_operator_index}" \
| jq "select(\
.name == \"${devworkspace_operator_package_name}\" \
or .package == \"${devworkspace_operator_package_name}\" \
.name == \"${devworkspace_operator_package_name}.${devworkspace_operator_version}\" \
and .schema == \"olm.bundle\" \
)" \
> "${my_catalog}/${devworkspace_operator_package_name}/render.json"
# FIXME: filter only the required version to limit the number of related images to mirror.
# or (.package == \"${devworkspace_operator_package_name}\" and .schema == \"olm.channel\" ) \
# or .name == \"${devworkspace_operator_package_name}.${devworkspace_operator_version}\" \

echo "Fetching metadata for the ${prod_operator_package_name} operator catalog channel, packages, and bundles."
opm render "${prod_operator_index}" \
| jq "select(\
.name == \"${prod_operator_package_name}\" \
or .package == \"${prod_operator_package_name}\" \
.name == \"${prod_operator_package_name}.${prod_operator_version}\" \
and .schema == \"olm.bundle\" \
)" \
> "${my_catalog}/${prod_operator_package_name}/render.json"
# FIXME: filter only the required version to limit the number of related images to mirror.
# or (.package == \"${prod_operator_package_name}\" and .schema == \"olm.channel\" ) \
# or .name == \"${prod_operator_bundle_name}.${prod_operator_version}\" \

echo "Creating the catalog dockerfile."
if [ -f "${my_catalog}.Dockerfile" ]; then
Expand Down Expand Up @@ -106,7 +99,7 @@ apiVersion: org.eclipse.che/v2
spec:
containerRegistry:
hostname: "$my_registry"
organization: "${my_catalog}"
organization: "$my_catalog"
EOF

echo "Removing index image from mappings.txt to prepare mirroring."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ $ bash prepare-restricted-environment.sh \
--devworkspace_operator_index "{devworkspace-operator-index}" \
--devworkspace_operator_version "v{devworkspace-operator-version-patch}" \
--prod_operator_index "{prod-operator-index}" \
--prod_operator_bundle_name "{prod-operator-bundle-name}" \
--prod_operator_package_name "{prod-operator-package-name}" \
--prod_operator_version "v{prod-ver-patch}" \
--my_registry "__<my_registry>__"
--my_registry "__<my_registry>__" \
--my_catalog "__<my_catalog>__"
----

0 comments on commit e9b70be

Please sign in to comment.