@@ -521,6 +521,15 @@ install_hostpath () {
521521 return 1
522522 fi
523523
524+ if ${CSI_PROW_BUILD_JOB} ; then
525+ # Ignore: Double quote to prevent globbing and word splitting.
526+ # Ignore: To read lines rather than words, pipe/redirect to a 'while read' loop.
527+ # shellcheck disable=SC2086 disable=SC2013
528+ for i in $( grep ' ^\s*CMDS\s*=' Makefile | sed -e ' s/\s*CMDS\s*=//' ) ; do
529+ kind load docker-image --name csi-prow $i :csiprow || die " could not load the $i :latest image into the kind cluster"
530+ done
531+ fi
532+
524533 if deploy_hostpath=" $( find_deployment " $( pwd) /deploy" ) " ; then
525534 :
526535 elif [ " ${CSI_PROW_HOSTPATH_REPO} " = " none" ]; then
@@ -848,102 +857,99 @@ main () {
848857 run_with_go " ${CSI_PROW_GO_VERSION_BUILD} " make container || die " 'make container' failed"
849858 fi
850859
851- install_kind || die " installing kind failed "
852- start_cluster || die " starting the cluster failed"
860+ if test_enabled " sanity " || test_enabled " parallel " || test_enabled " serial " || test_enabled " serial-alpha " || test_enabled " parallel-alpha " ; then
861+ install_kind || die " installing kind failed"
853862
854- if ${CSI_PROW_BUILD_JOB} ; then
855- cmds=" $( grep ' ^\s*CMDS\s*=' Makefile | sed -e ' s/\s*CMDS\s*=//' ) "
856- # Get the image that was just built (if any) from the
857- # top-level Makefile CMDS variable and set the
858- # deploy-hostpath.sh env variables for it. We also need to
859- # side-load those images into the cluster.
860- for i in $cmds ; do
861- e=$( echo " $i " | tr ' [:lower:]' ' [:upper:]' | tr - _)
862- images=" $images ${e} _REGISTRY=none ${e} _TAG=csiprow"
863-
864- # We must avoid the tag "latest" because that implies
865- # always pulling the image
866- # (https://github.com/kubernetes-sigs/kind/issues/328).
867- docker tag " $i :latest" " $i :csiprow" || die " tagging the locally built container image for $i failed"
868- kind load docker-image --name csi-prow " $i :csiprow" || die " could not load the $i :latest image into the kind cluster"
869- done
863+ if ${CSI_PROW_BUILD_JOB} ; then
864+ cmds=" $( grep ' ^\s*CMDS\s*=' Makefile | sed -e ' s/\s*CMDS\s*=//' ) "
865+ # Get the image that was just built (if any) from the
866+ # top-level Makefile CMDS variable and set the
867+ # deploy-hostpath.sh env variables for it. We also need to
868+ # side-load those images into the cluster.
869+ for i in $cmds ; do
870+ e=$( echo " $i " | tr ' [:lower:]' ' [:upper:]' | tr - _)
871+ images=" $images ${e} _REGISTRY=none ${e} _TAG=csiprow"
872+
873+ # We must avoid the tag "latest" because that implies
874+ # always pulling the image
875+ # (https://github.com/kubernetes-sigs/kind/issues/328).
876+ docker tag " $i :latest" " $i :csiprow" || die " tagging the locally built container image for $i failed"
877+ done
870878
871- if [ -e deploy/kubernetes/rbac.yaml ]; then
872- # This is one of those components which has its own RBAC rules (like external-provisioner).
873- # We are testing a locally built image and also want to test with the the current,
874- # potentially modified RBAC rules.
875- if [ " $( echo " $cmds " | wc -w) " != 1 ]; then
876- die " ambiguous deploy/kubernetes/rbac.yaml: need exactly one command, got: $cmds "
879+ if [ -e deploy/kubernetes/rbac.yaml ]; then
880+ # This is one of those components which has its own RBAC rules (like external-provisioner).
881+ # We are testing a locally built image and also want to test with the the current,
882+ # potentially modified RBAC rules.
883+ if [ " $( echo " $cmds " | wc -w) " != 1 ]; then
884+ die " ambiguous deploy/kubernetes/rbac.yaml: need exactly one command, got: $cmds "
885+ fi
886+ e=$( echo " $cmds " | tr ' [:lower:]' ' [:upper:]' | tr - _)
887+ images=" $images ${e} _RBAC=$( pwd) /deploy/kubernetes/rbac.yaml"
877888 fi
878- e=$( echo " $cmds " | tr ' [:lower:]' ' [:upper:]' | tr - _)
879- images=" $images ${e} _RBAC=$( pwd) /deploy/kubernetes/rbac.yaml"
880889 fi
881- fi
882-
883- # Installing the driver might be disabled, in which case we bail out early.
884- if ! install_hostpath " $images " ; then
885- info " hostpath driver installation disabled, skipping E2E testing"
886- return " $ret "
887- fi
888890
889- collect_cluster_info
890-
891- if test_enabled " sanity" ; then
892- if ! run_sanity; then
893- ret=1
894- fi
895- fi
896-
897- if test_enabled " parallel" ; then
898- # Ignore: Double quote to prevent globbing and word splitting.
899- # shellcheck disable=SC2086
900- if ! run_e2e parallel ${CSI_PROW_GINKO_PARALLEL} \
901- -focus=" External.Storage" \
902- -skip=" $( regex_join " ${CSI_PROW_E2E_SERIAL} " " ${CSI_PROW_E2E_ALPHA} " " ${CSI_PROW_E2E_SKIP} " ) " ; then
903- warn " E2E parallel failed"
904- ret=1
905- fi
906- fi
907-
908- if test_enabled " serial" ; then
909- if ! run_e2e serial \
910- -focus=" External.Storage.*($( regex_join " ${CSI_PROW_E2E_SERIAL} " ) )" \
911- -skip=" $( regex_join " ${CSI_PROW_E2E_ALPHA} " " ${CSI_PROW_E2E_SKIP} " ) " ; then
912- warn " E2E serial failed"
913- ret=1
914- fi
915- fi
916-
917- if (test_enabled " parallel-alpha" || test_enabled " serial-alpha" ) && [ " ${CSI_PROW_E2E_ALPHA_GATES} " ]; then
918- # Need to (re)create the cluster.
919- start_cluster " ${CSI_PROW_E2E_ALPHA_GATES} " || die " starting alpha cluster failed"
920- if ${CSI_PROW_BUILD_JOB} ; then
921- # Ignore: Double quote to prevent globbing and word splitting.
922- # Ignore: To read lines rather than words, pipe/redirect to a 'while read' loop.
923- # shellcheck disable=SC2086 disable=SC2013
924- for i in $( grep ' ^\s*CMDS\s*=' Makefile | sed -e ' s/\s*CMDS\s*=//' ) ; do
925- kind load docker-image --name csi-prow $i :csiprow || die " could not load the $i :latest image into the kind cluster"
926- done
927- fi
928- install_hostpath " $images " || die " hostpath driver installation failed unexpectedly on alpha cluster"
929-
930- if test_enabled " parallel-alpha" ; then
931- # Ignore: Double quote to prevent globbing and word splitting.
932- # shellcheck disable=SC2086
933- if ! run_e2e parallel-alpha ${CSI_PROW_GINKO_PARALLEL} \
934- -focus=" External.Storage.*($( regex_join " ${CSI_PROW_E2E_ALPHA} " ) )" \
935- -skip=" $( regex_join " ${CSI_PROW_E2E_SERIAL} " " ${CSI_PROW_E2E_SKIP} " ) " ; then
936- warn " E2E parallel alpha failed"
937- ret=1
891+ if test_enabled " sanity" || test_enabled " parallel" || test_enabled " serial" ; then
892+ start_cluster || die " starting the cluster failed"
893+
894+ # Installing the driver might be disabled.
895+ if install_hostpath " $images " ; then
896+ collect_cluster_info
897+
898+ if test_enabled " sanity" ; then
899+ if ! run_sanity; then
900+ ret=1
901+ fi
902+ fi
903+
904+ if test_enabled " parallel" ; then
905+ # Ignore: Double quote to prevent globbing and word splitting.
906+ # shellcheck disable=SC2086
907+ if ! run_e2e parallel ${CSI_PROW_GINKO_PARALLEL} \
908+ -focus=" External.Storage" \
909+ -skip=" $( regex_join " ${CSI_PROW_E2E_SERIAL} " " ${CSI_PROW_E2E_ALPHA} " " ${CSI_PROW_E2E_SKIP} " ) " ; then
910+ warn " E2E parallel failed"
911+ ret=1
912+ fi
913+ fi
914+
915+ if test_enabled " serial" ; then
916+ if ! run_e2e serial \
917+ -focus=" External.Storage.*($( regex_join " ${CSI_PROW_E2E_SERIAL} " ) )" \
918+ -skip=" $( regex_join " ${CSI_PROW_E2E_ALPHA} " " ${CSI_PROW_E2E_SKIP} " ) " ; then
919+ warn " E2E serial failed"
920+ ret=1
921+ fi
922+ fi
938923 fi
939924 fi
940925
941- if test_enabled " serial-alpha" ; then
942- if ! run_e2e serial-alpha \
943- -focus=" External.Storage.*(($( regex_join " ${CSI_PROW_E2E_SERIAL} " ) ).*($( regex_join " ${CSI_PROW_E2E_ALPHA} " ) )|($( regex_join " ${CSI_PROW_E2E_ALPHA} " ) ).*($( regex_join " ${CSI_PROW_E2E_SERIAL} " ) ))" \
944- -skip=" $( regex_join " ${CSI_PROW_E2E_SKIP} " ) " ; then
945- warn " E2E serial alpha failed"
946- ret=1
926+ if (test_enabled " parallel-alpha" || test_enabled " serial-alpha" ) && [ " ${CSI_PROW_E2E_ALPHA_GATES} " ]; then
927+ # Need to (re)create the cluster.
928+ start_cluster " ${CSI_PROW_E2E_ALPHA_GATES} " || die " starting alpha cluster failed"
929+
930+ # Installing the driver might be disabled.
931+ if install_hostpath " $images " ; then
932+ collect_cluster_info
933+
934+ if test_enabled " parallel-alpha" ; then
935+ # Ignore: Double quote to prevent globbing and word splitting.
936+ # shellcheck disable=SC2086
937+ if ! run_e2e parallel-alpha ${CSI_PROW_GINKO_PARALLEL} \
938+ -focus=" External.Storage.*($( regex_join " ${CSI_PROW_E2E_ALPHA} " ) )" \
939+ -skip=" $( regex_join " ${CSI_PROW_E2E_SERIAL} " " ${CSI_PROW_E2E_SKIP} " ) " ; then
940+ warn " E2E parallel alpha failed"
941+ ret=1
942+ fi
943+ fi
944+
945+ if test_enabled " serial-alpha" ; then
946+ if ! run_e2e serial-alpha \
947+ -focus=" External.Storage.*(($( regex_join " ${CSI_PROW_E2E_SERIAL} " ) ).*($( regex_join " ${CSI_PROW_E2E_ALPHA} " ) )|($( regex_join " ${CSI_PROW_E2E_ALPHA} " ) ).*($( regex_join " ${CSI_PROW_E2E_SERIAL} " ) ))" \
948+ -skip=" $( regex_join " ${CSI_PROW_E2E_SKIP} " ) " ; then
949+ warn " E2E serial alpha failed"
950+ ret=1
951+ fi
952+ fi
947953 fi
948954 fi
949955 fi
0 commit comments