@@ -11,35 +11,29 @@ 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+ - \$ KUSTOMIZE - path to the kustomize binary.
17+ - \$ LOCAL_REGISTRY_HOST - registry address accessible from the test process.
18+ - \$ CLUSTER_REGISTRY_HOST - registry address accessible from inside the cluster.
19+ - \$ CATALOG_TAG - OCI tag for the catalog image (e.g. e2e/test-catalog:v1).
20+ - \$ REG_PKG_NAME - the name of the package for the extension.
1721
1822Usage:
19- setup.sh [OPERATOR_SDK] [CONTAINER_RUNTIME] [KUSTOMIZE] [LOCAL_REGISTRY_HOST] [CLUSTER_REGISTRY_HOST]
23+ setup.sh
2024"
2125
2226# #######################################
2327# Input validation
2428# #######################################
2529
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
30+ for var in OPERATOR_SDK CONTAINER_RUNTIME KUSTOMIZE LOCAL_REGISTRY_HOST CLUSTER_REGISTRY_HOST CATALOG_TAG REG_PKG_NAME; do
31+ if [[ -z " ${! var:- } " ]]; then
32+ echo " \$ $var is required to be set"
33+ echo " ${help} "
34+ exit 1
35+ fi
36+ done
4337
4438# #######################################
4539# Setup temp dir and local variables
@@ -54,21 +48,21 @@ DOMAIN=oc-opdev-e2e.operatorframework.io
5448REG_DIR=" ${TMP_ROOT} /registry"
5549mkdir -p " ${REG_DIR} "
5650
57- operator_sdk=$1
58- container_tool=$2
59- kustomize=$3
51+ operator_sdk=" ${OPERATOR_SDK} "
52+ container_tool=" ${CONTAINER_RUNTIME} "
53+ kustomize=" ${KUSTOMIZE} "
6054# The path we use to push the image from _outside_ the cluster
61- local_registry_host=$4
55+ local_registry_host=" ${LOCAL_REGISTRY_HOST} "
6256# The path we use _inside_ the cluster
63- cluster_registry_host=$5
57+ cluster_registry_host=" ${CLUSTER_REGISTRY_HOST} "
6458
6559tls_flag=" "
6660if [[ " $container_tool " == " podman" ]]; then
6761 echo " Using podman container runtime; adding tls disable flag"
6862 tls_flag=" --tls-verify=false"
6963fi
7064
71- catalog_push_tag=" ${local_registry_host} /${E2E_TEST_CATALOG_V1 } "
65+ catalog_push_tag=" ${local_registry_host} /${CATALOG_TAG } "
7266reg_pkg_name=" ${REG_PKG_NAME} "
7367
7468reg_img=" ${DOMAIN} /registry:v0.0.1"
@@ -102,6 +96,7 @@ reg_bundle_push_tag="${local_registry_host}/${reg_bundle_path}"
10296 --resource --controller && \
10397 export OPERATOR_SDK=" ${operator_sdk} " && \
10498 make generate manifests && \
99+ sed -i -e ' s/$(CONTAINER_TOOL) build/$(CONTAINER_TOOL) build --provenance=false/' Makefile && \
105100 make docker-build IMG=" ${reg_img} " && \
106101 sed -i -e ' s/$(OPERATOR_SDK) generate kustomize manifests -q/$(OPERATOR_SDK) generate kustomize manifests -q --interactive=false/g' Makefile && \
107102 make bundle IMG=" ${reg_img} " VERSION=0.0.1 && \
@@ -153,5 +148,5 @@ cat <<EOF > "${TMP_ROOT}"/catalog/index.yaml
153148}
154149EOF
155150
156- ${container_tool} build -f " ${TMP_ROOT} /catalog.Dockerfile" -t " ${catalog_push_tag} " " ${TMP_ROOT} /"
151+ ${container_tool} build --provenance=false - f " ${TMP_ROOT} /catalog.Dockerfile" -t " ${catalog_push_tag} " " ${TMP_ROOT} /"
157152${container_tool} push ${catalog_push_tag} ${tls_flag}
0 commit comments