You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2022/10/12 10:46:34 UTC
[GitHub] [camel-k] phantomjinx commented on a diff in pull request #3527: Improvements to OLM bundle building of test index
phantomjinx commented on code in PR #3527:
URL: https://github.com/apache/camel-k/pull/3527#discussion_r993297676
##########
script/build_bundle_index.sh:
##########
@@ -58,43 +60,82 @@ fi
mkdir -p "${INDEX_DIR}"
-if [ ! -f ${INDEX_DIR}/bundles.yaml ]; then
- ${OPM} render ${BUNDLE_INDEX} -o yaml > ${INDEX_DIR}/bundles.yaml
+if [ ! -f ${INDEX_BASE_YAML} ]; then
+ ${OPM} render ${BUNDLE_INDEX} -o yaml > ${INDEX_BASE_YAML}
if [ $? != 0 ]; then
echo "Error: failed to render the base catalog"
exit 1
fi
fi
-${OPM} render --skip-tls -o yaml \
- ${BUNDLE_IMAGE} > ${PACKAGE_YAML}
-if [ $? != 0 ]; then
- echo "Error: failed to render the ${PACKAGE} bundle catalog"
- exit 1
+if [ ! -f ${PACKAGE_YAML} ]; then
+ ${OPM} render --skip-tls -o yaml \
+ ${BUNDLE_IMAGE} > ${PACKAGE_YAML}
+ if [ $? != 0 ]; then
+ echo "Error: failed to render the ${PACKAGE} bundle catalog"
+ exit 1
+ fi
fi
+#
+# Extract the camel-k channels
+#
+yq eval ". | select(.package == \"${PACKAGE}\" and .schema == \"olm.channel\")" ${INDEX_BASE_YAML} > ${CHANNELS_YAML}
Review Comment:
Done
##########
script/build_bundle_index.sh:
##########
@@ -58,43 +60,82 @@ fi
mkdir -p "${INDEX_DIR}"
-if [ ! -f ${INDEX_DIR}/bundles.yaml ]; then
- ${OPM} render ${BUNDLE_INDEX} -o yaml > ${INDEX_DIR}/bundles.yaml
+if [ ! -f ${INDEX_BASE_YAML} ]; then
+ ${OPM} render ${BUNDLE_INDEX} -o yaml > ${INDEX_BASE_YAML}
if [ $? != 0 ]; then
echo "Error: failed to render the base catalog"
exit 1
fi
fi
-${OPM} render --skip-tls -o yaml \
- ${BUNDLE_IMAGE} > ${PACKAGE_YAML}
-if [ $? != 0 ]; then
- echo "Error: failed to render the ${PACKAGE} bundle catalog"
- exit 1
+if [ ! -f ${PACKAGE_YAML} ]; then
+ ${OPM} render --skip-tls -o yaml \
+ ${BUNDLE_IMAGE} > ${PACKAGE_YAML}
+ if [ $? != 0 ]; then
+ echo "Error: failed to render the ${PACKAGE} bundle catalog"
+ exit 1
+ fi
fi
+#
+# Extract the camel-k channels
+#
+yq eval ". | select(.package == \"${PACKAGE}\" and .schema == \"olm.channel\")" ${INDEX_BASE_YAML} > ${CHANNELS_YAML}
+if [ $? != 0 ] || [ ! -f "${CHANNELS_YAML}" ]; then
+ echo "ERROR: Failed to extract camel-k entries from bundle catalog"
+ exit 1
+fi
+#
+# Filter out the channels in the bundles file
+#
+yq -i eval ". | select(.package != \"${PACKAGE}\" or .schema != \"olm.channel\")" ${INDEX_BASE_YAML}
+if [ $? != 0 ]; then
+ echo "ERROR: Failed to remove camel-k channel entries from bundles catalog"
+ exit 1
+fi
-cat << EOF >> ${PACKAGE_YAML}
----
-schema: olm.channel
-package: ${PACKAGE}
-name: ${CHANNEL}
-entries:
- - name: ${CSV_NAME}
-EOF
+#
+# Split the channels and append/insert the bundle into each one
+#
+IFS=','
+#Read the split words into an array based on comma delimiter
+read -a CHANNEL_ARR <<< "${CHANNELS}"
Review Comment:
Done
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org