Skip to content

Commit

Permalink
Reduce travis runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
erwinvaneyk committed Mar 22, 2018
1 parent f7355a3 commit f5ed948
Show file tree
Hide file tree
Showing 11 changed files with 173 additions and 162 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ 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-kube-setup.sh
- test/e2e/travis-setup.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
Expand All @@ -48,8 +48,7 @@ script:
# Unit and Integration tests
- test/runtests.sh
# End-to-end tests
# TODO no need to rebuild (tag images with test ID and check if they exist before starting to rebuild)
- test/e2e/travis-buildtest.sh
- NOBUILD=true test/e2e/buildtest.sh

after_script:
- test/e2e/cleanup.sh
Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# To run (from repo root): docker build -t fission -f ./build/Dockerfile .
ARG NOBUILD
ARG GOLANG_VERSION=1.10.0
FROM golang:$GOLANG_VERSION AS builder
ARG NOBUILD

WORKDIR /go/src/github.com/fission/fission-workflows

Expand Down
3 changes: 1 addition & 2 deletions build/build-env/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Builders
ARG BUNDLE_IMAGE=fission-workflows-bundle
ARG BUNDLE_TAG=latest
ARG FISSION_BUILDER_IMAGE=fission/builder
ARG FISSION_TAG=0.6.0

# Builders
FROM $BUNDLE_IMAGE:$BUNDLE_TAG as workflows-bundle

FROM $FISSION_BUILDER_IMAGE:$FISSION_TAG

COPY --from=workflows-bundle /wfcli /usr/local/bin/wfcli
Expand Down
16 changes: 4 additions & 12 deletions build/docker.sh
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
#!/usr/bin/env bash

set -e
set -euo pipefail

#
# Builds all docker images. Usage docker.sh [<repo>] [<tag>]
#
BUILD_ROOT=$(dirname $0)

IMAGE_REPO=$1
if [ -z "$IMAGE_REPO" ]; then
IMAGE_REPO=fission
fi

IMAGE_TAG=$2
if [ -z "$IMAGE_TAG" ]; then
IMAGE_TAG=latest
fi
IMAGE_REPO=${1:-fission}
IMAGE_TAG=${2:-latest}

# Build bundle images
bundleImage=${IMAGE_REPO}/fission-workflows-bundle
Expand All @@ -33,7 +25,7 @@ if [ ! -z "$NOBUILD" ]; then
fi
echo "Building bundle..."
docker build --tag="${bundleImage}:${IMAGE_TAG}" -f ${BUILD_ROOT}/Dockerfile \
--build-arg NOBUILD="${NOBUILD}" .
--no-cache --build-arg NOBUILD="${NOBUILD}" .
popd

# Build bundle-dependent images
Expand Down
3 changes: 1 addition & 2 deletions build/runtime-env/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# Builders
ARG BUNDLE_IMAGE=fission-workflows-bundle
ARG BUNDLE_TAG=latest
ARG FISSION_BUILDER_IMAGE=fission/builder
ARG FISSION_TAG=0.6.0

# Builders
FROM $BUNDLE_IMAGE:$BUNDLE_TAG as workflows-bundle

FROM scratch

COPY --from=workflows-bundle /fission-workflows-bundle /fission-workflows-bundle
Expand Down
21 changes: 0 additions & 21 deletions test/e2e/buildtest.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,6 @@ TEST_STATUS=0
TEST_LOGFILE_PATH=tests.log
BIN_DIR="${BIN_DIR:-$HOME/testbin}"

#
# Deploy Fission
# TODO use test specific namespace
emph "Deploying Fission: helm chart '${fissionHelmId}' in namespace '${NS}'..."
# Needs to be retried because k8s can still be busy with cleaning up
# helm_install_fission ${fissionHelmId} ${NS} ${FISSION_VERSION} "serviceType=NodePort,pullPolicy=IfNotPresent,
# analytics=false"
controllerPort=31234
routerPort=31235
helm_install_fission ${fissionHelmId} ${NS} ${FISSION_VERSION} "controllerPort=${controllerPort},routerPort=${routerPort},pullPolicy=Always,analytics=false"

# Direct CLI to the deployed cluster
#set_environment ${NS} ${routerPort}
emph "Fission environment: FISSION_URL: '${FISSION_URL:-EMPTY}' and FISSION_ROUTER: '${FISSION_ROUTER:-EMPTY}'"

# Wait for Fission to get ready
emph "Waiting for fission to be ready..."
sleep 5
retry fission fn list
echo
emph "Fission deployed!"

#
# Build
Expand Down
18 changes: 8 additions & 10 deletions test/e2e/cleanup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ BIN_DIR="${BIN_DIR:-$HOME/testbin}"

cleanup() {
emph "Removing Fission and Fission Workflow deployments..."
helm_uninstall_release ${fissionWorkflowsHelmId} || true
helm_uninstall_release ${fissionHelmId} || true
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
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..."
Expand All @@ -41,7 +41,9 @@ cleanup() {

print_report() {
emph "--- Test Report ---"
cat ${TEST_LOGFILE_PATH} | grep '\(FAILURE\|SUCCESS\).*|'
if ! cat ${TEST_LOGFILE_PATH} | grep '\(FAILURE\|SUCCESS\).*|' ; then
echo "No report found."
fi
emph "--- End Test Report ---"
}

Expand All @@ -65,9 +67,5 @@ on_exit() {
fi
}

# Ensure that minikube cluster is cleaned (in case it is an existing cluster)
emph "Cleaning up cluster..."
retry cleanup

# Ensure printing of report
on_exit
37 changes: 0 additions & 37 deletions test/e2e/travis-buildtest.sh

This file was deleted.

72 changes: 0 additions & 72 deletions test/e2e/travis-kube-setup.sh

This file was deleted.

Loading

0 comments on commit f5ed948

Please sign in to comment.