Skip to content

Commit

Permalink
resolve review
Browse files Browse the repository at this point in the history
Signed-off-by: Jordan Keister <[email protected]>
  • Loading branch information
grokspawn committed Aug 30, 2024
1 parent 370a725 commit 4afb3d1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
12 changes: 12 additions & 0 deletions hack/generate-readme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,19 @@ if [ ! -f "$RESOURCE" ]; then
fi
echo "# $(yq '.metadata.name' $RESOURCE) $(yq '.kind | downcase' $RESOURCE)"
echo
echo "## Description"
yq '.spec.description' $RESOURCE
if [ -f "$(dirname $RESOURCE)"/USAGE.md ]; then
echo
echo "For further information on how to use the task, see the USAGE.md file."
fi
if [ -f "$(dirname $RESOURCE)"/TROUBLESHOOTING.md ]; then
echo
echo "For troubleshooting assistance, see the TROUBLESHOOTING.md file."
fi
if [ -f "$(dirname $RESOURCE)"/USAGE.md ] | [ -f "$(dirname $RESOURCE)"/TROUBLESHOOTING.md ]; then
echo
fi
echo
PARAMS=$(yq '
.spec.params.[] |
Expand Down
4 changes: 3 additions & 1 deletion task/fbc-validation/0.1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

## Description:
Ensures file-based catalog (FBC) components are uniquely linted for proper construction as part of build pipeline.
For details on specific checks, see the USAGE.md file.

For further information on how to use the task, see the USAGE.md file.

For troubleshooting assistance, see the TROUBLESHOOTING.md file.

## Params:
Expand Down
2 changes: 1 addition & 1 deletion task/fbc-validation/0.1/USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ To validate the schema format of the FBC fragment, the test
3. executes `opm validate` over the fragment

### At least one package in fragment
To validate that at least one package is included in the fragment, the test renders the FBC using `opm` and uses `jq` to count instances of `olm.package` and fail if there are none.
To validate that at least one package is included in the fragment, the test renders the FBC using `opm` and uses `jq` to count instances of `olm.package` and fails if there are none.

### Bundle metadata in the appropriate format
To validate bundle metadata, the test evaluates bundle metadata usage against the target OCP version:
Expand Down
18 changes: 8 additions & 10 deletions task/fbc-validation/0.1/fbc-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ metadata:
spec:
description: >-
Ensures file-based catalog (FBC) components are uniquely linted for proper construction as part of build pipeline.
For details on specific checks, see the USAGE.md file.
For troubleshooting assistance, see the TROUBLESHOOTING.md file.
params:
- name: IMAGE_URL
description: Fully qualified image name.
Expand Down Expand Up @@ -158,27 +156,27 @@ spec:
if [[ ! $(find . -name "grpc_health_probe") ]]; then
echo "!FAILURE! - grpc_health_probe binary presence check failed."
failure_num=`expr $failure_num + 1`
failure_num=$(($failure_num + 1))
TESTPASSED=false
fi
if ! ${OPM_BINARY} validate ."${conffolder}"; then
echo "!FAILURE! - opm validate check failed."
failure_num=`expr $failure_num + 1`
failure_num=$(($failure_num + 1))
TESTPASSED=false
fi
OPM_RENDERED_CATALOG=/tmp/catalog.json
${OPM_BINARY} render ."${conffolder}" > ${OPM_RENDERED_CATALOG}
if [ ! -f ${OPM_RENDERED_CATALOG} ]; then
echo "!FAILURE! - unable to render the fragment FBC."
failure_num=`expr $failure_num + 1`
failure_num=$(( $failure_num + 1 ))
TESTPASSED=false
fi
if jq -en 'reduce (inputs | select(.schema == "olm.package")) as $obj (0; .+1) < 1' ${OPM_RENDERED_CATALOG}; then
echo "!FAILURE! - There are no olm package entries defined in this FBC fragment."
failure_num=`expr $failure_num + 1`
failure_num=$(($failure_num + 1))
TESTPASSED=false
fi
Expand All @@ -197,13 +195,13 @@ spec:
if [[ "${OCP_BUNDLE_METADATA_FORMAT}" = "olm.csv.metadata" ]]; then
if ! jq -en 'reduce( inputs | select(.schema == "olm.bundle" and .properties[].type == "olm.bundle.object")) as $_ (0;.+1) == 0' ${OPM_RENDERED_CATALOG}; then
echo "!FAILURE! - olm.bundle.object bundle properties are not permitted in a FBC fragment for OCP version ${OCP_VER_MAJOR}.${OCP_VER_MINOR}. Fragments must move to olm.csv.metadata bundle metadata."
failure_num=`expr $failure_num + 1`
failure_num=$(($failure_num + 1))
TESTPASSED=false
fi
else
if ! jq -en 'reduce( inputs | select(.schema == "olm.bundle" and .properties[].type == "olm.csv.metadata")) as $_ (0;.+1) == 0' ${OPM_RENDERED_CATALOG}; then
echo "!FAILURE! - olm.csv.metadata bundle properties are not permitted in a FBC fragment for OCP version ${OCP_VER_MAJOR}.${OCP_VER_MINOR}. Fragments must only use olm.bundle.object bundle metadata."
failure_num=`expr $failure_num + 1`
failure_num=$(($failure_num + 1))
TESTPASSED=false
fi
fi
Expand All @@ -216,13 +214,13 @@ spec:
if [[ "${OCP_BUNDLE_METADATA_FORMAT}" = "olm.csv.metadata" ]]; then
if [[ "${BUNDLE_COUNT}" -ne "${BUNDLE_CM_COUNT}" ]]; then
echo "!FAILURE! - every olm.bundle object in the fragment must have a corresponding olm.csv.metadata bundle property"
failure_num=`expr $failure_num + 1`
failure_num=$(($failure_num + 1))
TESTPASSED=false
fi
else
if [[ "${BUNDLE_BO_COUNT}" -lt "${BUNDLE_COUNT}" ]]; then
echo "!FAILURE! - every olm.bundle object in the fragment must have at least one olm.bundle.object bundle property"
failure_num=`expr $failure_num + 1`
failure_num=$(($failure_num + 1))
TESTPASSED=false
fi
fi
Expand Down

0 comments on commit 4afb3d1

Please sign in to comment.