@@ -11,35 +11,28 @@ following bundle formats:
1111This script will ensure that all images built are loaded onto
1212a KinD cluster with the name specified in the arguments.
1313The following environment variables are required for configuring this script:
14- - \$ E2E_TEST_CATALOG_V1 - the tag for the catalog image that contains the registry+v1 bundle.
15- - \$ REG_PKG_NAME - the name of the package for the extension that uses the registry+v1 bundle format.
16- setup.sh also takes 5 arguments.
14+ - \$ OPERATOR_SDK - path to the operator-sdk binary.
15+ - \$ CONTAINER_RUNTIME - container runtime to use (e.g. docker, podman).
16+ - \$ LOCAL_REGISTRY_HOST - registry address accessible from the test process.
17+ - \$ CLUSTER_REGISTRY_HOST - registry address accessible from inside the cluster.
18+ - \$ CATALOG_TAG - OCI tag for the catalog image (e.g. e2e/test-catalog:v1).
19+ - \$ REG_PKG_NAME - the name of the package for the extension.
1720
1821Usage:
19- setup.sh [OPERATOR_SDK] [CONTAINER_RUNTIME] [KUSTOMIZE] [LOCAL_REGISTRY_HOST] [CLUSTER_REGISTRY_HOST]
22+ setup.sh
2023"
2124
2225# #######################################
2326# Input validation
2427# #######################################
2528
26- if [[ " $# " -ne 5 ]]; then
27- echo " Illegal number of arguments passed"
28- echo " ${help} "
29- exit 1
30- fi
31-
32- if [[ -z " ${E2E_TEST_CATALOG_V1} " ]]; then
33- echo " \$ E2E_TEST_CATALOG_V1 is required to be set"
34- echo " ${help} "
35- exit 1
36- fi
37-
38- if [[ -z " ${REG_PKG_NAME} " ]]; then
39- echo " \$ REG_PKG_NAME is required to be set"
40- echo " ${help} "
41- exit 1
42- fi
29+ for var in OPERATOR_SDK CONTAINER_RUNTIME LOCAL_REGISTRY_HOST CLUSTER_REGISTRY_HOST CATALOG_TAG REG_PKG_NAME; do
30+ if [[ -z " ${! var:- } " ]]; then
31+ echo " \$ $var is required to be set"
32+ echo " ${help} "
33+ exit 1
34+ fi
35+ done
4336
4437# #######################################
4538# Setup temp dir and local variables
@@ -54,21 +47,20 @@ DOMAIN=oc-opdev-e2e.operatorframework.io
5447REG_DIR=" ${TMP_ROOT} /registry"
5548mkdir -p " ${REG_DIR} "
5649
57- operator_sdk=$1
58- container_tool=$2
59- kustomize=$3
50+ operator_sdk=" ${OPERATOR_SDK} "
51+ container_tool=" ${CONTAINER_RUNTIME} "
6052# The path we use to push the image from _outside_ the cluster
61- local_registry_host=$4
53+ local_registry_host=" ${LOCAL_REGISTRY_HOST} "
6254# The path we use _inside_ the cluster
63- cluster_registry_host=$5
55+ cluster_registry_host=" ${CLUSTER_REGISTRY_HOST} "
6456
6557tls_flag=" "
6658if [[ " $container_tool " == " podman" ]]; then
6759 echo " Using podman container runtime; adding tls disable flag"
6860 tls_flag=" --tls-verify=false"
6961fi
7062
71- catalog_push_tag=" ${local_registry_host} /${E2E_TEST_CATALOG_V1 } "
63+ catalog_push_tag=" ${local_registry_host} /${CATALOG_TAG } "
7264reg_pkg_name=" ${REG_PKG_NAME} "
7365
7466reg_img=" ${DOMAIN} /registry:v0.0.1"
@@ -102,6 +94,7 @@ reg_bundle_push_tag="${local_registry_host}/${reg_bundle_path}"
10294 --resource --controller && \
10395 export OPERATOR_SDK=" ${operator_sdk} " && \
10496 make generate manifests && \
97+ sed -i -e ' s/$(CONTAINER_TOOL) build/$(CONTAINER_TOOL) build --provenance=false/' Makefile && \
10598 make docker-build IMG=" ${reg_img} " && \
10699 sed -i -e ' s/$(OPERATOR_SDK) generate kustomize manifests -q/$(OPERATOR_SDK) generate kustomize manifests -q --interactive=false/g' Makefile && \
107100 make bundle IMG=" ${reg_img} " VERSION=0.0.1 && \
@@ -153,5 +146,5 @@ cat <<EOF > "${TMP_ROOT}"/catalog/index.yaml
153146}
154147EOF
155148
156- ${container_tool} build -f " ${TMP_ROOT} /catalog.Dockerfile" -t " ${catalog_push_tag} " " ${TMP_ROOT} /"
149+ ${container_tool} build --provenance=false - f " ${TMP_ROOT} /catalog.Dockerfile" -t " ${catalog_push_tag} " " ${TMP_ROOT} /"
157150${container_tool} push ${catalog_push_tag} ${tls_flag}
0 commit comments