Commit 3e558def authored by Tim Leers's avatar Tim Leers Committed by Geoff Simmons

inline commands

parent ec13f4d6
stages: stages:
- test
- build - build
- e2e - e2e
- test
test: test:
image: golang:1.11.6 image: golang:1.11.6
...@@ -70,33 +70,35 @@ build:controller: ...@@ -70,33 +70,35 @@ build:controller:
- docker push $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/$IMAGE:latest - docker push $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/$IMAGE:latest
integration: integration:
stage: e2e needs: ["build:controller"]
image: docker:19.03.8 stage: e2e
services: image: docker:19.03.8
- docker:19.03.8-dind services:
variables: - docker:19.03.8-dind
KUBECTL: v1.17.0 variables:
KIND: v0.7.0 KUBECTL: v1.17.0
before_script: KIND: v0.7.0
- apk add -U wget before_script:
- apk add -U varnish - apk add -U wget
- apk add -U make - apk add -U varnish
- apk add -U bash - apk add -U make
- wget -O /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND}/kind-linux-amd64 - apk add -U bash
- chmod +x /usr/local/bin/kind - wget -O /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND}/kind-linux-amd64
- wget -O /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL}/bin/linux/amd64/kubectl - chmod +x /usr/local/bin/kind
- chmod +x /usr/local/bin/kubectl - wget -O /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL}/bin/linux/amd64/kubectl
- kind create cluster --config=.kind-gitlab.yaml - chmod +x /usr/local/bin/kubectl
- sed -i -E -e 's/localhost|0\.0\.0\.0/docker/g' "$HOME/.kube/config" - kind create cluster --config=.kind-gitlab.yaml
- kubectl get nodes -o wide - sed -i -E -e 's/localhost|0\.0\.0\.0/docker/g' "$HOME/.kube/config"
- kubectl get pods --all-namespaces -o wide - kubectl get nodes -o wide
- kubectl get services --all-namespaces -o wide - kubectl get pods --all-namespaces -o wide
script: - kubectl get services --all-namespaces -o wide
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY script:
- docker pull $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/controller:$CI_COMMIT_SHA - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
# using varnish image with latest tag due to performance. if we are changing this image a lot, we need to improve this as can lead to pulling the incorrect image - docker pull $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/controller:$CI_COMMIT_SHA
- docker pull $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/varnish:latest # using varnish image with latest tag due to performance. if we are changing this image a lot, we need to improve this as can lead to pulling the incorrect image
- docker tag $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/controller:$CI_COMMIT_SHA varnish-ingress/controller - docker pull $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/varnish:latest
- docker tag $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/varnish:latest varnish-ingress/ingress - docker tag $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/controller:$CI_COMMIT_SHA varnish-ingress/controller
- docker tag $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/varnish:latest varnish-ingress/varnish
- test/e2e.sh - kind load docker-image varnish-ingress/varnish
- kind load docker-image varnish-ingress/controller
- test/e2e.sh
...@@ -4,13 +4,6 @@ function killforward { ...@@ -4,13 +4,6 @@ function killforward {
kill $KUBEPID kill $KUBEPID
} }
failureCode() {
local code=${2:-500}
local status=$(curl --head --location --connect-timeout 5 --write-out %{http_code} --silent --output /dev/null localhost:${LOCALPORT})
[[ $status == ${code} ]] || [[ $status == 000 ]]
}
LOCALPORT=${LOCALPORT:-8888} LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress,example!=cli-args --for=delete kubectl wait --timeout=2m pod -l app=varnish-ingress,example!=cli-args --for=delete
...@@ -22,11 +15,5 @@ kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null & ...@@ -22,11 +15,5 @@ kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$! KUBEPID=$!
trap killforward EXIT trap killforward EXIT
for ((n = 0; n < 20; n++)); do sleep 1
if [[ failureCode ]] ; then
sleep 0.5
fi
break
done
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_cli-args.vtc varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_cli-args.vtc
...@@ -4,12 +4,6 @@ function killforward { ...@@ -4,12 +4,6 @@ function killforward {
kill $KUBEPID kill $KUBEPID
} }
failureCode() {
local code=${2:-500}
local status=$(curl --head --location --connect-timeout 5 --write-out %{http_code} --silent --output /dev/null localhost:${LOCALPORT})
[[ $status == ${code} ]] || [[ $status == 000 ]]
}
LOCALPORT=${LOCALPORT:-8888} LOCALPORT=${LOCALPORT:-8888}
kubectl wait --timeout=2m pod -l app=varnish-ingress,example!=proxy --for=delete kubectl wait --timeout=2m pod -l app=varnish-ingress,example!=proxy --for=delete
...@@ -21,11 +15,5 @@ kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null & ...@@ -21,11 +15,5 @@ kubectl port-forward svc/varnish-ingress ${LOCALPORT}:80 >/dev/null &
KUBEPID=$! KUBEPID=$!
trap killforward EXIT trap killforward EXIT
for ((n = 0; n < 20; n++)); do sleep 1
if [[ failureCode ]] ; then
sleep 0.5
fi
break
done
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_proxy.vtc varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_proxy.vtc
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment