From 454b4daefc77a9cd13427f12b1d030587e8f4158 Mon Sep 17 00:00:00 2001 From: erwinvaneyk Date: Fri, 23 Mar 2018 02:04:56 +0100 Subject: [PATCH] Improved travis build script --- .gitignore | 4 +- .travis.yml | 19 +-- build/docker.sh | 8 +- cmd/fission-workflows-bundle/bundle/bundle.go | 7 +- cmd/wfcli/invocation.go | 2 +- cmd/wfcli/main.go | 1 + test/e2e/buildtest.sh | 33 ++++- test/e2e/cleanup.sh | 73 +++++------ test/e2e/install-clients.sh | 49 ++++++++ .../__pycache__/testutils.cpython-36.pyc | Bin 680 -> 680 bytes test/e2e/travis-setup.sh | 115 +++++------------- test/e2e/utils.sh | 75 ++++-------- 12 files changed, 192 insertions(+), 194 deletions(-) create mode 100755 test/e2e/install-clients.sh diff --git a/.gitignore b/.gitignore index 2543051b..b37427ad 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,6 @@ data/ *.tgz /fission-workflows-bundle -/wfcli \ No newline at end of file +/wfcli +__pycache__/ +*.pyc \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index e621f9c0..c3eef75e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,12 +11,12 @@ cache: apt: true directories: - ${HOME}/.helm/ - - ${HOME}/testbin/ + - /tmp/fission-workflow-ci/bin - ${GOPATH}/bin/ - ${GOPATH}/pkg/ env: - - KUBECONFIG=${HOME}/.kube/config PATH=$HOME/testbin:${PATH} BIN_DIR=${HOME}/testbin + - KUBECONFIG=${HOME}/.kube/config PATH=/tmp/fission-workflow-ci/bin:${PATH} BIN_DIR=/tmp/fission-workflow-ci/bin services: - docker @@ -30,25 +30,26 @@ install: - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce - sudo apt-get -y install google-cloud-sdk - sudo apt-get -y install coreutils -- test/e2e/travis-setup.sh +- test/e2e/install-clients.sh # Needed for some integration tests -- glide -h > /dev/null || go get github.com/Masterminds/glide -- nats-streaming-server -h > /dev/null || go get github.com/nats-io/nats-streaming-server +# - glide -h >/dev/null 2>&1 || go get github.com/Masterminds/glide +- nats-streaming-server -h >/dev/null 2>&1 || go get github.com/nats-io/nats-streaming-server # TODO remove the need for this before_script: - cd ${TRAVIS_BUILD_DIR} # Static code analysis -- hack/verify-govet.sh - hack/verify-gofmt.sh +- hack/verify-govet.sh # Build -- glide install -v -- build/build-linux.sh +#- glide install -v +#- build/build-linux.sh +- test/e2e/travis-setup.sh script: # Unit and Integration tests - test/runtests.sh # End-to-end tests -- NOBUILD=true test/e2e/buildtest.sh +- test/e2e/buildtest.sh after_script: - test/e2e/cleanup.sh diff --git a/build/docker.sh b/build/docker.sh index 2d421705..c43fa0b1 100755 --- a/build/docker.sh +++ b/build/docker.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -set -euo pipefail +set -eo pipefail # # Builds all docker images. Usage docker.sh [] [] @@ -25,20 +25,24 @@ if [ ! -z "$NOBUILD" ]; then fi echo "Building bundle..." docker build --tag="${bundleImage}:${IMAGE_TAG}" -f ${BUILD_ROOT}/Dockerfile \ - --no-cache --build-arg NOBUILD="${NOBUILD}" . + --no-cache \ + --build-arg NOBUILD="${NOBUILD}" . popd # Build bundle-dependent images echo "Building Fission runtime env..." docker build --tag="${IMAGE_REPO}/workflow-env:${IMAGE_TAG}" ${BUILD_ROOT}/runtime-env/ \ + --no-cache \ --build-arg BUNDLE_IMAGE=${bundleImage} \ --build-arg BUNDLE_TAG=${IMAGE_TAG} echo "Building Fission build env..." docker build --tag="${IMAGE_REPO}/workflow-build-env:${IMAGE_TAG}" ${BUILD_ROOT}/build-env/ \ + --no-cache \ --build-arg BUNDLE_IMAGE=${bundleImage} \ --build-arg BUNDLE_TAG=${IMAGE_TAG} echo "Building wfcli..." docker build --tag="${IMAGE_REPO}/wfcli:${IMAGE_TAG}" ${BUILD_ROOT}/wfcli/ \ + --no-cache \ --build-arg BUNDLE_IMAGE=${bundleImage} \ --build-arg BUNDLE_TAG=${IMAGE_TAG} diff --git a/cmd/fission-workflows-bundle/bundle/bundle.go b/cmd/fission-workflows-bundle/bundle/bundle.go index d59b0d83..bdf6e8d0 100644 --- a/cmd/fission-workflows-bundle/bundle/bundle.go +++ b/cmd/fission-workflows-bundle/bundle/bundle.go @@ -79,9 +79,6 @@ func Run(ctx context.Context, opts *Options) error { es = natsEs esPub = natsEs } - if es == nil { - panic("no event store provided") - } // Caches wfiCache := getWorkflowInvocationCache(ctx, esPub) @@ -290,14 +287,14 @@ func runHttpGateway(ctx context.Context, gwSrv *http.Server, adminApiAddr string mux := grpcruntime.NewServeMux() grpcOpts := []grpc.DialOption{grpc.WithInsecure()} if adminApiAddr != "" { - err := apiserver.RegisterWorkflowAPIHandlerFromEndpoint(ctx, mux, adminApiAddr, grpcOpts) + err := apiserver.RegisterAdminAPIHandlerFromEndpoint(ctx, mux, adminApiAddr, grpcOpts) if err != nil { panic(err) } } if wfApiAddr != "" { - err := apiserver.RegisterAdminAPIHandlerFromEndpoint(ctx, mux, wfApiAddr, grpcOpts) + err := apiserver.RegisterWorkflowAPIHandlerFromEndpoint(ctx, mux, wfApiAddr, grpcOpts) if err != nil { panic(err) } diff --git a/cmd/wfcli/invocation.go b/cmd/wfcli/invocation.go index a1104c41..74eca6ce 100644 --- a/cmd/wfcli/invocation.go +++ b/cmd/wfcli/invocation.go @@ -25,7 +25,7 @@ var cmdInvocation = cli.Command{ Usage: "get ", Flags: []cli.Flag{ cli.DurationFlag{ - Name: "history, h", + Name: "history", Usage: "Amount history (non-active invocations) to show.", Value: time.Duration(1) * time.Hour, }, diff --git a/cmd/wfcli/main.go b/cmd/wfcli/main.go index 928e8ec0..4cebeb25 100644 --- a/cmd/wfcli/main.go +++ b/cmd/wfcli/main.go @@ -22,6 +22,7 @@ func main() { kubeConfig := getKubeConfigPath() localPort := setupPortForward(kubeConfig, fissionNamespace, "application=fission-api") value = "http://127.0.0.1:" + localPort + fmt.Printf("Forwarded Fission API to %s.\n", value) } else { value = fissionUrl } diff --git a/test/e2e/buildtest.sh b/test/e2e/buildtest.sh index b255c9a8..6ca3c80b 100755 --- a/test/e2e/buildtest.sh +++ b/test/e2e/buildtest.sh @@ -13,18 +13,47 @@ DOCKER_REPO=gcr.io/fission-ci WORKFLOWS_ENV_IMAGE=${DOCKER_REPO}/workflow-env WORKFLOWS_BUILD_ENV_IMAGE=${DOCKER_REPO}/workflow-build-env WORKFLOWS_BUNDLE_IMAGE=${DOCKER_REPO}/fission-workflows-bundle +TAG=test NS=fission NS_FUNCTION=fission-function NS_BUILDER=fission-builder fissionHelmId=fission fissionWorkflowsHelmId=fission-workflows FISSION_VERSION=0.6.0 -TAG=test TEST_STATUS=0 TEST_LOGFILE_PATH=tests.log BIN_DIR="${BIN_DIR:-$HOME/testbin}" +print_report() { + emph "--- Test Report ---" + if ! cat ${TEST_LOGFILE_PATH} | grep '\(FAILURE\|SUCCESS\).*|' ; then + echo "No report found." + fi + emph "--- End Test Report ---" +} + +on_exit() { + emph "[Buildtest exited]" + # Dump all the logs + dump_logs ${NS} ${NS_FUNCTION} ${NS_BUILDER} || true + + # Print a short test report + print_report + + # Ensure correct exist status + echo "TEST_STATUS: ${TEST_STATUS}" + if [ ${TEST_STATUS} -ne 0 ]; then + exit 1 + fi +} + +emph "Starting buildtest..." + +trap on_exit EXIT + +cleanup_fission_workflows ${fissionWorkflowsHelmId} || true + # # Build # @@ -50,7 +79,7 @@ gcloud docker -- push ${WORKFLOWS_BUNDLE_IMAGE}:${TAG} # Deploy Fission Workflows # TODO use test specific namespace emph "Deploying Fission Workflows '${fissionWorkflowsHelmId}' to ns '${NS}'..." -helm_install_fission_workflows ${fissionWorkflowsHelmId} ${NS} "pullPolicy=IfNotPresent,tag=${TAG},bundleImage=${WORKFLOWS_BUNDLE_IMAGE},envImage=${WORKFLOWS_ENV_IMAGE},buildEnvImage=${WORKFLOWS_BUILD_ENV_IMAGE}" +helm_install_fission_workflows ${fissionWorkflowsHelmId} ${NS} "pullPolicy=Always,tag=${TAG},bundleImage=${WORKFLOWS_BUNDLE_IMAGE},envImage=${WORKFLOWS_ENV_IMAGE},buildEnvImage=${WORKFLOWS_BUILD_ENV_IMAGE}" # Wait for Fission Workflows to get ready wfcli config diff --git a/test/e2e/cleanup.sh b/test/e2e/cleanup.sh index ed164dd3..202bb654 100755 --- a/test/e2e/cleanup.sh +++ b/test/e2e/cleanup.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash -set -euo pipefail +set -eu . $(dirname $0)/utils.sh @@ -14,58 +14,49 @@ TEST_STATUS=0 TEST_LOGFILE_PATH=tests.log BIN_DIR="${BIN_DIR:-$HOME/testbin}" -cleanup() { - emph "Removing Fission and Fission Workflow deployments..." - helm_uninstall_release ${fissionWorkflowsHelmId} & - helm_uninstall_release ${fissionHelmId} & - emph "Removing custom resources..." - clean_tpr_crd_resources || true +cleanup_fission_workflows() { + emph "Removing Fission Workflows deployment..." + helm_uninstall_release ${fissionWorkflowsHelmId} + # TODO cleanup workflow functions too +} +cleanup_fission() { # Trigger deletion of all namespaces before waiting - for concurrency of deletion emph "Forcing deletion of namespaces..." - kubectl delete ns/${NS} > /dev/null 2>&1 & # Sometimes it is not deleted by helm delete - kubectl delete ns/${NS_BUILDER} > /dev/null 2>&1 & # Sometimes it is not deleted by helm delete - kubectl delete ns/${NS_FUNCTION} > /dev/null 2>&1 & # Sometimes it is not deleted by helm delete + kubectl delete ns/${NS} --now > /dev/null 2>&1 # Sometimes it is not deleted by helm delete + kubectl delete ns/${NS_BUILDER} --now > /dev/null 2>&1 # Sometimes it is not deleted by helm delete + kubectl delete ns/${NS_FUNCTION} --now > /dev/null 2>&1 # Sometimes it is not deleted by helm delete + + cleanup_fission_workflows + emph "Removing Fission deployment..." + helm_uninstall_release ${fissionHelmId} + + emph "Removing custom resources..." + clean_tpr_crd_resources || true # Wait until all namespaces are actually deleted! + sleep 10 emph "Awaiting deletion of namespaces..." - retry kubectl delete ns/${NS} 2>&1 | grep -qv "Error from server (Conflict):" - retry kubectl delete ns/${NS_BUILDER} 2>&1 | grep -qv "Error from server (Conflict):" - retry kubectl delete ns/${NS_FUNCTION} 2>&1 | grep -qv "Error from server (Conflict):" + verify_ns_deleted() { + kubectl delete ns/${1} --now 2>&1 | grep -qv "Error from server (Conflict):" + } + RETRY_LIMIT=10 RETRY_DELAY=10 retry verify_ns_deleted ${NS} + RETRY_LIMIT=10 RETRY_DELAY=10 retry verify_ns_deleted ${NS_BUILDER} + # Function namespace takes a long time to sometimes for some reason + RETRY_LIMIT=10 RETRY_DELAY=10 retry verify_ns_deleted ${NS_FUNCTION} emph "Cleaning up local filesystem..." rm -f ./fission-workflows-bundle ./wfcli - sleep 5 -} - -print_report() { - emph "--- Test Report ---" - if ! cat ${TEST_LOGFILE_PATH} | grep '\(FAILURE\|SUCCESS\).*|' ; then - echo "No report found." - fi - emph "--- End Test Report ---" } -on_exit() { - emph "[Buildtest exited]" - # Dump all the logs - dump_logs ${NS} ${NS_FUNCTION} ${NS_BUILDER} || true - - # Ensure teardown after tests finish - # TODO provide option to not cleanup the test setup after tests (e.g. for further tests) - emph "Cleaning up cluster..." - retry cleanup - - # Print a short test report - print_report - - # Ensure correct exist status - echo "TEST_STATUS: ${TEST_STATUS}" - if [ ${TEST_STATUS} -ne 0 ]; then - exit 1 - fi +reset_fission_crd_resources() { + NS_CRDS=${1:-default} + echo "TODO reset fission" + exit 1 + # TODO remove all functions, etc. + reset_crd_resources } # Ensure printing of report -on_exit +retry cleanup_fission \ No newline at end of file diff --git a/test/e2e/install-clients.sh b/test/e2e/install-clients.sh new file mode 100755 index 00000000..413e5903 --- /dev/null +++ b/test/e2e/install-clients.sh @@ -0,0 +1,49 @@ +#!/usr/bin/env bash + +set -euo pipefail + +. $(dirname $0)/utils.sh + +BIN_DIR=${BIN_DIR:-/tmp/fission-workflow-ci/bin} +HELM_VERSION=2.8.2 +KUBECTL_VERSION=1.9.6 +FISSION_VERSION=0.6.0 + +# Install kubectl +if ! kubectl version 2>/dev/null | grep ${KUBECTL_VERSION} >/dev/null; then + emph "Installing kubectl ${KUBECTL_VERSION} to ${BIN_DIR}/kubectl..." + curl -sLO https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl + chmod +x ./kubectl + mv -f kubectl ${BIN_DIR}/kubectl +else + emph "Kubectl ${KUBECTL_VERSION} already present." +fi +mkdir -p ${HOME}/.kube +command -v kubectl + +# Install helm client +if ! helm version 2>/dev/null | grep ${HELM_VERSION} >/dev/null; then + emph "Installing Helm ${HELM_VERSION} to ${BIN_DIR}/helm..." + curl -sLO https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz + tar xzvf helm-*.tar.gz + chmod +x linux-amd64/helm + mv -f linux-amd64/helm ${BIN_DIR}/helm +else + emph "Helm ${HELM_VERSION} already present." +fi +command -v helm + +# Install Fission client +if ! fission --version 2>/dev/null | grep ${FISSION_VERSION} >/dev/null; then + emph "Installing Fission ${FISSION_VERSION} to ${BIN_DIR}/fission..." + curl -sLo fission https://github.com/fission/fission/releases/download/${FISSION_VERSION}/fission-cli-linux + chmod +x fission + mv -f fission ${BIN_DIR}/fission +else + emph "Fission ${FISSION_VERSION} already present." +fi +command -v fission + +# TODO install gcloud + +emph "Clients installed in ${BIN_DIR}" \ No newline at end of file diff --git a/test/e2e/tests/__pycache__/testutils.cpython-36.pyc b/test/e2e/tests/__pycache__/testutils.cpython-36.pyc index 23218294a252065eb468f310f141c3bf14a58997..e6ab081c9527e0c4e811589cd78163501934f2d0 100644 GIT binary patch delta 16 XcmZ3%x`LJ6n3tF9=b6fl>/dev/null | grep ${KUBECTL_VERSION} >/dev/null; then - emph "Installing kubectl ${KUBECTL_VERSION}..." - curl -sLO https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl - chmod +x ./kubectl - mv -f kubectl ${BIN_DIR}/kubectl -else - emph "Kubectl ${KUBECTL_VERSION} already present." -fi -mkdir -p ${HOME}/.kube -kubectl version - -# Get helm binary -if ! helm version 2>/dev/null | grep ${HELM_VERSION} >/dev/null; then - emph "Installing Helm ${HELM_VERSION}..." - curl -sLO https://storage.googleapis.com/kubernetes-helm/helm-v${HELM_VERSION}-linux-amd64.tar.gz - tar xzvf helm-*.tar.gz - chmod +x linux-amd64/helm - mv -f linux-amd64/helm ${BIN_DIR}/helm -else - emph "Helm ${HELM_VERSION} already present." -fi -helm version - +#export PATH=${BIN_DIR}:${PATH} Assume that this BIN_DIR is in path # Setup gcloud CI if [ -z "${FISSION_WORKFLOWS_CI_SERVICE_ACCOUNT:-}" ] @@ -60,18 +36,10 @@ else fi # get kube config -gcloud container clusters get-credentials fission-workflows-ci-1 --zone us-central1-a --project fission-ci - -# Get Fission binary -if ! fission --version 2>/dev/null | grep ${FISSION_VERSION} >/dev/null; then - emph "Installing Fission ${FISSION_VERSION}..." -# curl -sLo fission https://github.com/fission/fission/releases/download/${FISSION_VERSION}/fission-cli-linux -# chmod +x fission -# mv -f fission ${BIN_DIR}/fission -else - emph "Fission ${FISSION_VERSION} already present." +if ! cat ${HOME}/.kube/config | grep "current-context: gke_fission-ci_us-central1-a_fission-workflows-ci-1" ; then + emph "Connecting to gcloud cluster..." + gcloud container clusters get-credentials fission-workflows-ci-1 --zone us-central1-a --project fission-ci fi -#fission --version # Is Kubernetes setup correctly? if [ ! -f ${HOME}/.kube/config ] @@ -81,8 +49,7 @@ then fi kubectl get node - -# Install helm +# Install helm in Kubernetes cluster echo "Setting up helm..." helm init @@ -107,48 +74,28 @@ if ! helm repo list | grep fission-charts >/dev/null 2>&1 ; then fi helm repo update -# Check if Fission -if ! helm list | grep fission-all-${FISSION_VERSION} ; then - # Clean up existing - emph "Removing existing Fission and Fission Workflow deployments..." - helm_uninstall_release ${fissionWorkflowsHelmId} & - helm_uninstall_release ${fissionHelmId} & - - emph "Removing custom resources..." - clean_tpr_crd_resources || true - - # Trigger deletion of all namespaces before waiting - for concurrency of deletion - emph "Forcing deletion of namespaces..." - kubectl delete ns/${NS} > /dev/null 2>&1 & # Sometimes it is not deleted by helm delete - kubectl delete ns/${NS_BUILDER} > /dev/null 2>&1 & # Sometimes it is not deleted by helm delete - kubectl delete ns/${NS_FUNCTION} > /dev/null 2>&1 & # Sometimes it is not deleted by helm delete - - # Wait until all namespaces are actually deleted! - emph "Awaiting deletion of namespaces..." - retry kubectl delete ns/${NS} 2>&1 | grep -qv "Error from server (Conflict):" - retry kubectl delete ns/${NS_BUILDER} 2>&1 | grep -qv "Error from server (Conflict):" - retry kubectl delete ns/${NS_FUNCTION} 2>&1 | grep -qv "Error from server (Conflict):" - - emph "Cleaning up local filesystem..." - rm -f ./fission-workflows-bundle ./wfcli - sleep 5 - - # Deploy Fission - # TODO use test specific namespace - emph "Deploying Fission: helm chart '${fissionHelmId}' in namespace '${NS}'..." - controllerPort=31234 - routerPort=31235 - helm_install_fission ${fissionHelmId} ${NS} ${FISSION_VERSION} \ - "controllerPort=${controllerPort},routerPort=${routerPort},pullPolicy=Always,analytics=false" +. $(dirname $0)/cleanup.sh - # Wait for Fission to get ready - emph "Waiting for fission to be ready..." - sleep 5 - retry fission fn list - echo - emph "Fission deployed!" -else - emph "Reusing existing Fission ${FISSION_VERSION} deployment" - emph "Removing custom resources..." - clean_tpr_crd_resources || true -fi +# Check if Fission +# Deploy Fission +# TODO use test specific namespace +emph "Deploying Fission: helm chart '${fissionHelmId}' in namespace '${NS}'..." +controllerPort=31234 +routerPort=31235 +helm_install_fission ${fissionHelmId} ${NS} ${FISSION_VERSION} \ + "controllerPort=${controllerPort},routerPort=${routerPort},pullPolicy=Always,analytics=false" + +# Wait for Fission to get ready +emph "Waiting for fission to be ready..." +sleep 5 +retry fission fn list +echo +fission --version +emph "Fission deployed!" + +# Verify clients +ls -l ${BIN_DIR} +kubectl version +helm version +fission --version +emph "All clients available!" \ No newline at end of file diff --git a/test/e2e/utils.sh b/test/e2e/utils.sh index 84206553..d419d5d0 100644 --- a/test/e2e/utils.sh +++ b/test/e2e/utils.sh @@ -12,6 +12,10 @@ clean_tpr_crd_resources() { kubectl --namespace default get crd| grep -v NAME| grep "fission.io"| awk '{print $1}'|xargs -I@ bash -c "kubectl --namespace default delete crd @" || true } +reset_fission_crd_resources() { + kubectl --namespace default get crd| grep -v NAME| grep "fission.io"| awk '{print $1}'|xargs -I@ bash -c "kubectl --namespace default delete @ --all" || true +} + helm_setup() { helm init } @@ -27,43 +31,15 @@ gcloud_login() { } generate_test_id() { - echo $(date|md5sum|cut -c1-6) || echo $(date|md5|cut -c1-6) -} - -set_environment() { - ns=$1 - port=$2 - -# export FISSION_ROUTER=$(kubectl -n ${ns} get svc router -o jsonpath='{...ip}') - - # Port forawrd the router to the local port which is the default of the `fission` - kubectl get pods -l svc="router" -o name --namespace $ns | \ - sed 's/^.*\///' | \ - xargs -I{} kubectl port-forward {} $port:$port -n $ns & - - export FISSION_ROUTER="127.0.0.1:{$port}" + if command -v md5sum 2>/dev/null >/dev/null; then + # Linux + date|md5sum|cut -c1-6 + else + # Mac OS X + date|md5|cut -c1-6 + fi } -#run_all_tests() { -# id=$1 -# -# export FISSION_NAMESPACE=f-${id} -# export FUNCTION_NAMESPACE=f-func-${id} -# -# for file in ${ROOT}/test/tests/test_* -# do -# TEST_ID=$(generate_test_id) -# echo ------- Running ${file} ------- -# if ${file} -# then -# echo SUCCESS: ${file} -# else -# echo FAILED: ${file} -# export FAILURES=$(($FAILURES+1)) -# fi -# done -#} - dump_all_resources_in_ns() { ns=$1 @@ -90,13 +66,7 @@ helm_install_fission() { } helm_uninstall_release() { - if [ ! -z ${FISSION_TEST_SKIP_DELETE:+} ] - then - echo "Fission uninstallation skipped" - return - fi - echo "Uninstalling $1" - helm delete --purge $1 + helm delete --debug --purge $1 } helm_install_fission_workflows() { @@ -152,14 +122,14 @@ print_test_result() { # https://unix.stackexchange.com/questions/82598/how-do-i-write-a-retry-logic-in-script-to-keep-retrying-to-run-it-upto-5-times/82610 function retry { local n=1 - local max=5 - local delay=5 + RETRY_LIMIT=${MAX_RETRIES:-5} + RETRY_DELAY=${RETRY_DELAY:-5} while true; do "$@" && break || { - if [[ ${n} -lt ${max} ]]; then + if [[ ${n} -lt ${RETRY_LIMIT} ]]; then ((n++)) - echo "Command '$@' failed. Attempt $n/$max:" - sleep ${delay}; + echo "Command '$@' failed. Attempt $n/${RETRY_LIMIT}:" + sleep ${RETRY_DELAY}; else >&2 echo "The command has failed after $n attempts." exit 1; @@ -218,7 +188,7 @@ dump_env_pods() { fns=$1 echo --- All environment pods --- - kubectl -n $fns get pod -o yaml + kubectl -n ${fns} get pod -o yaml echo --- End environment pods --- } @@ -226,7 +196,7 @@ dump_all_fission_resources() { ns=$1 echo "--- All objects in the fission namespace $ns ---" - kubectl -n $ns get all + kubectl -n ${ns} get all echo "--- End objects in the fission namespace $ns ---" } @@ -286,3 +256,10 @@ dump_logs() { dump_fission_crds dump_system_info } + +cleanup_fission_workflows() { + helmID=$1 + emph "Removing Fission Workflow deployment..." + helm_uninstall_release ${helmID} + # TODO remove workflows? +}