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