CircleCI - refactor Istio e2e testing

This commit is contained in:
stefanprodan
2019-06-21 14:26:12 +03:00
parent f4bb0ea9c2
commit 48834cd8d1
9 changed files with 104 additions and 78 deletions

View File

@@ -38,9 +38,7 @@ jobs:
docker_layer_caching: true
- attach_workspace:
at: /tmp/bin
- run: |
cp /tmp/bin/flagger . && chmod +x flagger
docker build -t weaveworks/flagger:latest . -f ./test/Dockerfile.ci
- run: test/container-build.sh
- run: test/container-push.sh
e2e-istio-testing:
@@ -49,39 +47,36 @@ jobs:
- checkout
- attach_workspace:
at: /tmp/bin
- run: |
cp /tmp/bin/flagger . && chmod +x flagger
docker build -t test/flagger:latest . -f ./test/Dockerfile.ci
- run: test/container-build.sh
- run: test/e2e-kind.sh
- run: test/e2e-istio.sh
- run: test/e2e-istio-build.sh
- run: test/e2e-tests.sh
e2e-smi-istio-testing:
machine: true
steps:
- checkout
- run: test/container-build.sh
- run: test/e2e-kind.sh
- run: test/e2e-istio.sh
- run: test/e2e-smi-istio-build.sh
- run: test/e2e-smi-istio.sh
- run: test/e2e-tests.sh canary
e2e-supergloo-testing:
machine: true
steps:
- checkout
- run: test/container-build.sh
- run: test/e2e-kind.sh
- run: test/e2e-supergloo.sh
- run: test/e2e-build.sh supergloo:test.supergloo-system
- run: test/e2e-tests.sh canary
e2e-gloo-testing:
machine: true
steps:
- checkout
- run: test/container-build.sh
- run: test/e2e-kind.sh
- run: test/e2e-gloo.sh
- run: test/e2e-gloo-build.sh
- run: test/e2e-gloo-tests.sh
e2e-nginx-testing:
@@ -110,10 +105,30 @@ workflows:
- /gh-pages.*/
- /docs-.*/
- /release-.*/
- e2e-smi-istio-testing:
requires:
- build-binary
filters:
branches:
ignore:
- /gh-pages.*/
- /docs-.*/
- /release-.*/
- e2e-supergloo-testing:
requires:
- build-binary
filters:
branches:
ignore:
- /gh-pages.*/
- /docs-.*/
- /release-.*/
- push-container:
requires:
- build-binary
- e2e-istio-testing
- e2e-smi-istio-testing
- e2e-supergloo-testing
filters:
branches:
ignore:

6
test/container-build.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -o errexit
cp /tmp/bin/flagger . && chmod +x flagger
docker build -t test/flagger:latest . -f ./test/Dockerfile.ci

View File

@@ -8,7 +8,7 @@ if [[ -z "$DOCKER_PASS" ]]; then
echo "No Docker Hub credentials, skipping image push";
else
echo $DOCKER_PASS | docker login -u=$DOCKER_USER --password-stdin;
docker tag weaveworks/flagger:latest weaveworks/flagger:${BRANCH_COMMIT};
docker tag test/flagger:latest weaveworks/flagger:${BRANCH_COMMIT};
docker push weaveworks/flagger:${BRANCH_COMMIT};
fi
@@ -16,6 +16,6 @@ if [[ -z "$CIRCLE_TAG" ]]; then
echo "Not a release, skipping image push";
else
echo $DOCKER_PASS | docker login -u=$DOCKER_USER --password-stdin;
docker tag weaveworks/flagger:latest weaveworks/flagger:${CIRCLE_TAG};
docker tag test/flagger:latest weaveworks/flagger:${CIRCLE_TAG};
docker push weaveworks/flagger:${CIRCLE_TAG};
fi

View File

@@ -1,20 +0,0 @@
#!/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/
if [ -n "$1" ]; then
kubectl -n istio-system set env deployment/flagger "MESH_PROVIDER=$1"
fi
kubectl -n istio-system set image deployment/flagger flagger=test/flagger:latest
kubectl -n istio-system rollout status deployment/flagger

View File

@@ -1,17 +0,0 @@
#!/usr/bin/env bash
set -o errexit
REPO_ROOT=$(git rev-parse --show-toplevel)
export KUBECONFIG="$(kind get kubeconfig-path --name="kind")"
echo '>>> Load Flagger image in Kind'
kind load docker-image test/flagger:latest
echo '>>> Installing Flagger'
helm upgrade -i flagger ${REPO_ROOT}/charts/flagger \
--namespace istio-system \
--set meshProvider=istio
kubectl -n istio-system set image deployment/flagger flagger=test/flagger:latest
kubectl -n istio-system rollout status deployment/flagger

View File

@@ -28,3 +28,14 @@ echo '>>> Installing Istio control plane'
helm upgrade -i istio istio.io/istio --wait --namespace istio-system -f ${REPO_ROOT}/test/e2e-istio-values.yaml
kubectl -n istio-system get all
echo '>>> Load Flagger image in Kind'
kind load docker-image test/flagger:latest
echo '>>> Installing Flagger'
helm upgrade -i flagger ${REPO_ROOT}/charts/flagger \
--namespace istio-system \
--set meshProvider=istio
kubectl -n istio-system set image deployment/flagger flagger=test/flagger:latest
kubectl -n istio-system rollout status deployment/flagger

View File

@@ -1,25 +0,0 @@
#!/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
kind load docker-image test/flagger:latest
echo '>>> Installing Flagger'
helm upgrade -i flagger ${REPO_ROOT}/charts/flagger \
--namespace istio-system \
--set meshProvider=smi:istio
kubectl -n istio-system set image deployment/flagger flagger=test/flagger:latest
kubectl -n istio-system rollout status deployment/flagger
echo '>>> Installing the SMI Istio adapter'
kubectl apply -f ${REPO_ROOT}/artifacts/smi/istio-adapter.yaml
kubectl -n istio-system rollout status deployment/smi-adapter-istio

45
test/e2e-smi-istio.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -o errexit
ISTIO_VER="1.1.9"
REPO_ROOT=$(git rev-parse --show-toplevel)
export KUBECONFIG="$(kind get kubeconfig-path --name="kind")"
echo ">>> Installing Helm"
curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get | bash
echo '>>> Installing Tiller'
kubectl --namespace kube-system create sa tiller
kubectl create clusterrolebinding tiller-cluster-rule --clusterrole=cluster-admin --serviceaccount=kube-system:tiller
helm init --service-account tiller --upgrade --wait
echo ">>> Installing Istio ${ISTIO_VER}"
helm repo add istio.io https://storage.googleapis.com/istio-release/releases/${ISTIO_VER}/charts
echo '>>> Installing Istio CRDs'
helm upgrade -i istio-init istio.io/istio-init --wait --namespace istio-system
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'
helm upgrade -i istio istio.io/istio --wait --namespace istio-system -f ${REPO_ROOT}/test/e2e-istio-values.yaml
echo '>>> Installing the SMI Istio adapter'
kubectl apply -f ${REPO_ROOT}/artifacts/smi/istio-adapter.yaml
kubectl -n istio-system rollout status deployment/smi-adapter-istio
echo '>>> Load Flagger image in Kind'
kind load docker-image test/flagger:latest
echo '>>> Installing Flagger'
helm upgrade -i flagger ${REPO_ROOT}/charts/flagger \
--namespace istio-system \
--set meshProvider=smi:istio
kubectl -n istio-system set image deployment/flagger flagger=test/flagger:latest
kubectl -n istio-system rollout status deployment/flagger

View File

@@ -22,9 +22,6 @@ do
sleep 2
done
# add rbac rules
kubectl create clusterrolebinding flagger-supergloo --clusterrole=mesh-discovery --serviceaccount=istio-system:flagger
kubectl -n istio-system rollout status deployment/istio-pilot
kubectl -n istio-system rollout status deployment/istio-policy
kubectl -n istio-system rollout status deployment/istio-sidecar-injector
@@ -32,3 +29,17 @@ kubectl -n istio-system rollout status deployment/istio-telemetry
kubectl -n istio-system rollout status deployment/prometheus
kubectl -n istio-system get all
echo '>>> Load Flagger image in Kind'
kind load docker-image test/flagger:latest
echo '>>> Installing Flagger'
helm upgrade -i flagger ${REPO_ROOT}/charts/flagger \
--namespace istio-system \
--set meshProvider=supergloo:test.supergloo-system
kubectl -n istio-system set image deployment/flagger flagger=test/flagger:latest
kubectl -n istio-system rollout status deployment/flagger
echo '>>> Adding Flagger Supergloo RBAC'
kubectl create clusterrolebinding flagger-supergloo --clusterrole=mesh-discovery --serviceaccount=istio-system:flagger