Skip to content

Commit f280d2b

Browse files
authored
Run certsuite image in container to avoid issues with glibc (#3275)
1 parent aff3491 commit f280d2b

File tree

1 file changed

+17
-24
lines changed

1 file changed

+17
-24
lines changed

script/run-basic-batch-operators-test.sh

Lines changed: 17 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ CATALOG_SOURCE_TEMPLATE="$(pwd)"/CatalogSource.yaml.template
2222
DOCKER_CONFIG=config.json
2323

2424
# Location of telco/non-telco classification file
25-
CNF_TYPE=cmd/certsuite/claim/show/csv/cnf-type.json
25+
CNF_TYPE_DIR="$(pwd)"cmd/certsuite/claim/show/csv
2626

2727
# Operator catalog name
2828
OPERATOR_CATALOG_NAME="operator-catalog"
@@ -649,23 +649,6 @@ while IFS=, read -r package_name catalog_index; do
649649
oc get pods -n "$ns" -o custom-columns=':.metadata.name,:.metadata.namespace,:.kind' | sed '/^ *$/d' | awk '{print " oc label " $3 " -n " $2 " " $1 " redhat-best-practices-for-k8s.com/generic=target "}' | bash || true
650650
} >>"$LOG_FILE_PATH" 2>&1
651651

652-
# Get latest certsuite container image
653-
echo_color "$BLUE" "Get latest certsuite executable from image: ${CERTSUITE_IMAGE_NAME}:${CERTSUITE_IMAGE_TAG}"
654-
{
655-
podman pull "${CERTSUITE_IMAGE_NAME}:${CERTSUITE_IMAGE_TAG}" || true
656-
podman run --replace -d --name temp-container "${CERTSUITE_IMAGE_NAME}:${CERTSUITE_IMAGE_TAG}" || true
657-
# sleep for a while to allow the container to come up and exit
658-
sleep 2
659-
podman cp temp-container:/usr/certsuite/certsuite . || true
660-
podman rm -f temp-container || true
661-
} >>"$LOG_FILE_PATH" 2>&1
662-
663-
if [ ! -f "./certsuite" ]; then
664-
echo_color "$RED" "Could not download latest certsuite executable, continue"
665-
report_failure "$status" "$ns" "$package_name" "Could not download latest certsuite, skipping test"
666-
continue
667-
fi
668-
669652
# Run certsuite container
670653
echo_color "$BLUE" "run CNF suite"
671654

@@ -675,11 +658,16 @@ while IFS=, read -r package_name catalog_index; do
675658
cp "$DOCKER_CONFIG" "$config_dir"/dockerconfig
676659
cp "$config_yaml" "$config_dir"/certsuite_config.yaml
677660

678-
./certsuite run \
679-
--kubeconfig="$config_dir"/kubeconfig \
680-
--preflight-dockerconfig="$config_dir"/dockerconfig \
681-
--config-file="$config_dir"/certsuite_config.yaml \
682-
--output-dir="$report_dir" \
661+
podman run --rm \
662+
--network=host \
663+
-v "${config_dir}:/config:Z" \
664+
-v "${report_dir}:/reports:Z" \
665+
"${CERTSUITE_IMAGE_NAME}:${CERTSUITE_IMAGE_TAG}" \
666+
/usr/local/bin/certsuite run \
667+
--kubeconfig=/config/kubeconfig \
668+
--preflight-dockerconfig=/config/dockerconfig \
669+
--config-file=/config/certsuite_config.yaml \
670+
--output-dir=/reports \
683671
--label-filter=all >>"$LOG_FILE_PATH" 2>&1 || {
684672
report_failure "$status" "$ns" "$package_name" "CNF suite exited with errors"
685673
continue
@@ -712,7 +700,12 @@ while IFS=, read -r package_name catalog_index; do
712700

713701
# merge claim.json from each operator to a single csv file
714702
echo_color "$BLUE" "add claim.json from this operator to the csv file"
715-
if ! ./certsuite claim show csv -c "$report_dir"/claim.json -n "$package_name" -t "$CNF_TYPE" "$add_headers" >>"$REPORT_FOLDER"/results.csv; then
703+
if ! podman run --rm \
704+
-v "${report_dir}:/reports:Z" \
705+
-v "${CNF_TYPE_DIR}:/cnftype:Z" \
706+
"${CERTSUITE_IMAGE_NAME}:${CERTSUITE_IMAGE_TAG}" \
707+
/usr/local/bin/certsuite claim \
708+
show csv -t /cnftype/cnf-type.json -c /reports/claim.json -n "$package_name" "$add_headers" >>"$REPORT_FOLDER"/results.csv; then
716709
echo_color "$RED" "failed to parse claim file"
717710
fi
718711

0 commit comments

Comments
 (0)