Commit e7ebaf29 authored by Tim Leers's avatar Tim Leers Committed by Geoff Simmons

build images, create kind cluster and run e2e for CI

parent da53b142
image: golang:1.11.6
cache:
paths:
- /apt-cache
- /go/bin
- /go/pkg
- /go/src/code.uplex.de
- /go/src/github.com
- /go/src/golang.org
- /go/src/google.golang.org
- /go/src/gopkg.in
- /go/src/k8s.io
stages:
- e2e
- test
before_script:
- go get -u golang.org/x/lint/golint
- go get -d -v github.com/slimhazard/gogitversion
- go mod download
- pushd /go/pkg/mod/github.com/slimhazard/gogitversion*
- make install
- popd
- build
test:
image: golang:1.11.6
stage: test
cache:
paths:
- /apt-cache
- /go/bin
- /go/pkg
- /go/src/code.uplex.de
- /go/src/github.com
- /go/src/golang.org
- /go/src/google.golang.org
- /go/src/gopkg.in
- /go/src/k8s.io
before_script:
- GO111MODULE=off go get -d github.com/slimhazard/gogitversion
- pushd $GOPATH/src/github.com/slimhazard/gogitversion*
- make install
- popd
- go get -u golang.org/x/lint/golint
- go mod download
script:
- make check
build:controller:
stage: build
image: docker:19.03.8
services:
- docker:19.03.8-dind
variables:
DOCKER_TLS_CERTDIR: "/certs"
CI_REGISTRY_IMAGE: varnish-controller
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker pull $CI_REGISTRY/timleers/k8s-ingress/$CI_REGISTRY_IMAGE:latest || true
- docker build --cache-from $CI_REGISTRY/timleers/k8s-ingress/$CI_REGISTRY_IMAGE:latest --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA --tag $CI_REGISTRY_IMAGE:latest -f container/Dockerfile.controller .
- docker tag $CI_REGISTRY_IMAGE:latest $CI_REGISTRY/timleers/k8s-ingress/$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker tag $CI_REGISTRY_IMAGE:latest $CI_REGISTRY/timleers/k8s-ingress/$CI_REGISTRY_IMAGE:latest
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker push $CI_REGISTRY/timleers/k8s-ingress/$CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
- docker push $CI_REGISTRY/timleers/k8s-ingress/$CI_REGISTRY_IMAGE:latest
# integration:
# stage: e2e
# image: tiltdev/tilt
# services:
# - docker:19.03.8-dind
# variables:
# DOCKER_HOST: "tcp://docker:2375"
# script:
# - apt install make
# - test/e2e.gitlab.sh
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:
- test/e2e.gitlab.sh
apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
networking:
apiServerAddress: "0.0.0.0"
# add to the apiServer certSANs the name of the docker (dind) service in order to be able to reach the cluster through it
kubeadmConfigPatchesJSON6902:
- group: kubeadm.k8s.io
version: v1beta2
kind: ClusterConfiguration
patch: |
- op: add
path: /apiServer/certSANs/-
value: docker
nodes:
- role: control-plane
- role: worker
#!/bin/bash
#
# Make sure the Kind local registry works as expected.
set -ex
cd $(dirname $0)
cd ../container
make all
kind load docker-image varnish-ingress/varnish
kind load docker-image varnish-ingress/controller
../test/e2e.sh
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