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

inline commands

parent ec13f4d6
stages:
- test
- build
- e2e
- test
test:
image: golang:1.11.6
......@@ -70,33 +70,35 @@ build:controller:
- docker push $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/$IMAGE:latest
integration:
stage: e2e
image: docker:19.03.8
services:
- docker:19.03.8-dind
variables:
KUBECTL: v1.17.0
KIND: v0.7.0
before_script:
- apk add -U wget
- apk add -U varnish
- apk add -U make
- apk add -U bash
- wget -O /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND}/kind-linux-amd64
- chmod +x /usr/local/bin/kind
- wget -O /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL}/bin/linux/amd64/kubectl
- chmod +x /usr/local/bin/kubectl
- kind create cluster --config=.kind-gitlab.yaml
- sed -i -E -e 's/localhost|0\.0\.0\.0/docker/g' "$HOME/.kube/config"
- kubectl get nodes -o wide
- kubectl get pods --all-namespaces -o wide
- kubectl get services --all-namespaces -o wide
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker pull $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/controller:$CI_COMMIT_SHA
# 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/varnish:latest
- 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/ingress
- test/e2e.sh
needs: ["build:controller"]
stage: e2e
image: docker:19.03.8
services:
- docker:19.03.8-dind
variables:
KUBECTL: v1.17.0
KIND: v0.7.0
before_script:
- apk add -U wget
- apk add -U varnish
- apk add -U make
- apk add -U bash
- wget -O /usr/local/bin/kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND}/kind-linux-amd64
- chmod +x /usr/local/bin/kind
- wget -O /usr/local/bin/kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL}/bin/linux/amd64/kubectl
- chmod +x /usr/local/bin/kubectl
- kind create cluster --config=.kind-gitlab.yaml
- sed -i -E -e 's/localhost|0\.0\.0\.0/docker/g' "$HOME/.kube/config"
- kubectl get nodes -o wide
- kubectl get pods --all-namespaces -o wide
- kubectl get services --all-namespaces -o wide
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker pull $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/controller:$CI_COMMIT_SHA
# 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/varnish:latest
- 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
- kind load docker-image varnish-ingress/varnish
- kind load docker-image varnish-ingress/controller
- test/e2e.sh
......@@ -4,13 +4,6 @@ function killforward {
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}
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 &
KUBEPID=$!
trap killforward EXIT
for ((n = 0; n < 20; n++)); do
if [[ failureCode ]] ; then
sleep 0.5
fi
break
done
sleep 1
varnishtest ${TESTOPTS} -Dlocalport=${LOCALPORT} cafe_cli-args.vtc
......@@ -4,12 +4,6 @@ function killforward {
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}
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 &
KUBEPID=$!
trap killforward EXIT
for ((n = 0; n < 20; n++)); do
if [[ failureCode ]] ; then
sleep 0.5
fi
break
done
sleep 1
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