Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Jul 22, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
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>__"
tolusha marked this conversation as resolved.
Show resolved Hide resolved
----