...
 
Commits (2)
......@@ -2,6 +2,27 @@ stages:
- test
- build
- e2e
- release
push_to_docker:
image: docker:19.03.8
stage: release
only:
- tags
services:
- docker:19.03.8-dind
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker pull $CI_REGISTRY_IMAGE/varnish-ingress/haproxy:$CI_COMMIT_REF_NAME
- docker pull $CI_REGISTRY_IMAGE/varnish-ingress/varnish:$CI_COMMIT_REF_NAME
- docker pull $CI_REGISTRY_IMAGE/varnish-ingress/controller:$CI_COMMIT_REF_NAME
- docker tag $CI_REGISTRY_IMAGE/varnish-ingress/haproxy:$CI_COMMIT_REF_NAME uplex/viking-haproxy:$CI_COMMIT_TAG
- docker tag $CI_REGISTRY_IMAGE/varnish-ingress/varnish:$CI_COMMIT_REF_NAME uplex/viking-varnish:$CI_COMMIT_TAG
- docker tag $CI_REGISTRY_IMAGE/varnish-ingress/controller:$CI_COMMIT_REF_NAME uplex/viking-controller:$CI_COMMIT_TAG
- docker login -u "$DOCKERHUB_USER" -p "$DOCKERHUB_CREDS"
- docker push uplex/viking-haproxy:$CI_COMMIT_TAG
- docker push uplex/viking-varnish:$CI_COMMIT_TAG
- docker push uplex/viking-controller:$CI_COMMIT_TAG
test:
image: golang:1.11.6
......@@ -22,6 +43,18 @@ test:
script:
- make check
# build new haproxy image if dockerfile changes
build:haproxy:
extends: .build-haproxy
rules:
- changes:
- container/Dockerfile.haproxy
# haproxy image can be build when user triggers it
build:haproxy:manual:
extends: .build-haproxy
when: manual
# build new varnish image if dockerfile changes
build:varnish:
extends: .build-varnish
......@@ -223,11 +256,14 @@ example:varnish-pod-template:
- kubectl get services --all-namespaces -o wide
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker pull $CI_REGISTRY_IMAGE/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_IMAGE/varnish-ingress/varnish:latest
# using haproxy and 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_IMAGE/varnish-ingress/varnish:$CI_COMMIT_REF_NAME
- docker pull $CI_REGISTRY_IMAGE/varnish-ingress/haproxy:$CI_COMMIT_REF_NAME
- docker tag $CI_REGISTRY_IMAGE/varnish-ingress/controller:$CI_COMMIT_SHA varnish-ingress/controller
- docker tag $CI_REGISTRY_IMAGE/varnish-ingress/varnish:latest varnish-ingress/varnish
- docker tag $CI_REGISTRY_IMAGE/varnish-ingress/haproxy:$CI_COMMIT_REF_NAME varnish-ingress/haproxy
- docker tag $CI_REGISTRY_IMAGE/varnish-ingress/varnish:$CI_COMMIT_REF_NAME varnish-ingress/varnish
- kind load docker-image varnish-ingress/varnish
- kind load docker-image varnish-ingress/haproxy
- kind load docker-image varnish-ingress/controller
- cd deploy
- ./init.sh
......@@ -243,6 +279,16 @@ example:varnish-pod-template:
script:
- cd container
- make varnish
#
# basic step for a pipeline to build the haproxy image
.build-haproxy:
extends: .build-image
stage: build
variables:
IMAGE: haproxy
script:
- cd container
- make haproxy
.build-image:
stage: build
......@@ -254,11 +300,9 @@ example:varnish-pod-template:
before_script:
- apk add -U make
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker pull $CI_REGISTRY_IMAGE/varnish-ingress/$IMAGE:latest || true
- docker pull $CI_REGISTRY_IMAGE/varnish-ingress/$IMAGE:$CI_COMMIT_REF_NAME || true
after_script:
- docker tag varnish-ingress/$IMAGE $CI_REGISTRY_IMAGE/varnish-ingress/$IMAGE:$CI_COMMIT_SHA
- docker tag varnish-ingress/$IMAGE $CI_REGISTRY_IMAGE/varnish-ingress/$IMAGE:$CI_COMMIT_REF_NAME
- docker tag varnish-ingress/$IMAGE $CI_REGISTRY_IMAGE/varnish-ingress/$IMAGE:latest
- docker push $CI_REGISTRY_IMAGE/varnish-ingress/$IMAGE:$CI_COMMIT_SHA
- docker push $CI_REGISTRY_IMAGE/varnish-ingress/$IMAGE:$CI_COMMIT_REF_NAME
- docker push $CI_REGISTRY_IMAGE/varnish-ingress/$IMAGE:latest