From ef423b20786a8a19d45fa5487bf312b1a05c06a8 Mon Sep 17 00:00:00 2001 From: stefanprodan Date: Sun, 24 Feb 2019 03:10:50 +0200 Subject: [PATCH] Move Flagger e2e build to a dedicated job --- .circleci/config.yml | 1 + test/e2e-build.sh | 15 +++++++++++++++ test/e2e-istio.sh | 3 +-- test/e2e-tests.sh | 17 +++++------------ test/e2e-workload.yaml | 8 ++++---- 5 files changed, 26 insertions(+), 18 deletions(-) create mode 100755 test/e2e-build.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index eb4639d0..c2304538 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,6 +6,7 @@ jobs: - checkout - run: test/e2e-kind.sh - run: test/e2e-istio.sh + - run: test/e2e-build.sh - run: test/e2e-tests.sh workflows: diff --git a/test/e2e-build.sh b/test/e2e-build.sh new file mode 100755 index 00000000..43dff8d0 --- /dev/null +++ b/test/e2e-build.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +set -o errexit + +REPO_ROOT=$(git rev-parse --show-toplevel) +export KUBECONFIG="$(kind get kubeconfig-path --name="kind")" + +echo '>>> Building Flagger' +cd ${REPO_ROOT} && docker build -t test/flagger:latest . -f Dockerfile + +echo '>>> Installing Flagger' +kind load docker-image test/flagger:latest +kubectl apply -f ${REPO_ROOT}/artifacts/flagger/ +kubectl -n istio-system set image deployment/flagger flagger=test/flagger:latest +kubectl -n istio-system rollout status deployment/flagger diff --git a/test/e2e-istio.sh b/test/e2e-istio.sh index 98753e34..71e2791d 100755 --- a/test/e2e-istio.sh +++ b/test/e2e-istio.sh @@ -4,7 +4,6 @@ set -o errexit ISTIO_VER="1.1.0-rc.0" REPO_ROOT=$(git rev-parse --show-toplevel) - export KUBECONFIG="$(kind get kubeconfig-path --name="kind")" echo ">>> Installing Helm" @@ -25,5 +24,5 @@ echo '>>> Waiting for Istio CRDs to be ready' kubectl -n istio-system wait --for=condition=complete job/istio-init-crd-10 kubectl -n istio-system wait --for=condition=complete job/istio-init-crd-11 -echo 'Installing Istio control plane' +echo '>>> Installing Istio control plane' helm upgrade -i istio istio.io/istio --wait --namespace istio-system -f ${REPO_ROOT}/test/e2e-istio-values.yaml \ No newline at end of file diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh index 975dd636..02589fbd 100755 --- a/test/e2e-tests.sh +++ b/test/e2e-tests.sh @@ -5,15 +5,6 @@ set -o errexit REPO_ROOT=$(git rev-parse --show-toplevel) export KUBECONFIG="$(kind get kubeconfig-path --name="kind")" -echo '>>> Building Flagger' -cd ${REPO_ROOT} && docker build -t test/flagger:latest . -f Dockerfile - -echo '>>> Installing Flagger' -kind load docker-image test/flagger:latest -kubectl apply -f ${REPO_ROOT}/artifacts/flagger/ -kubectl -n istio-system set image deployment/flagger flagger=test/flagger:latest -kubectl -n istio-system rollout status deployment/flagger - echo '>>> Creating test namespace' kubectl create namespace test kubectl label namespace test istio-injection=enabled @@ -56,7 +47,7 @@ spec: url: http://flagger-loadtester.test/ timeout: 5s metadata: - cmd: "hey -z 1m -q 10 -c 2 http://podinfo.test:9898/" + cmd: "hey -z 10m -q 10 -c 2 http://podinfo.test:9898/" EOF @@ -78,17 +69,19 @@ done echo '>>> Canary initialization test passed ✔︎' echo '>>> Triggering canary deployment' -kubectl -n test set image deployment/podinfo podinfod=quay.io/stefanprodan/podinfo:1.4.2 +kubectl -n test set image deployment/podinfo podinfod=quay.io/stefanprodan/podinfo:1.4.1 echo '>>> Waiting for canary promotion' retries=50 count=0 ok=false until ${ok}; do - kubectl -n test describe deployment/podinfo-primary | grep '1.4.2' && ok=true || ok=false + kubectl -n test describe deployment/podinfo-primary | grep '1.4.1' && ok=true || ok=false sleep 5 count=$(($count + 1)) if [[ ${count} -eq ${retries} ]]; then + kubectl -n test describe deployment/podinfo + kubectl -n test describe deployment/podinfo-canary kubectl -n istio-system logs deployment/flagger echo "No more retries left" exit 1 diff --git a/test/e2e-workload.yaml b/test/e2e-workload.yaml index 57ed8a41..83b199d7 100644 --- a/test/e2e-workload.yaml +++ b/test/e2e-workload.yaml @@ -60,8 +60,8 @@ spec: timeoutSeconds: 5 resources: limits: - cpu: 2000m - memory: 512Mi + cpu: 1000m + memory: 128Mi requests: - cpu: 100m - memory: 64Mi + cpu: 1m + memory: 16Mi