Commit 49595caf authored by Tim Leers's avatar Tim Leers

introduce general build-image step and reuse it

parent ec36b39c
...@@ -35,23 +35,13 @@ build:varnish:manual: ...@@ -35,23 +35,13 @@ build:varnish:manual:
when: manual when: manual
build:controller: build:controller:
extends: .build-image
stage: build stage: build
image: docker:19.03.8
services:
- docker:19.03.8-dind
variables: variables:
IMAGE: controller IMAGE: controller
before_script:
- apk add -U make
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script: script:
- docker pull $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/varnish-ingress/$IMAGE:latest || true
- cd container - cd container
- make controller - make controller
- docker tag varnish-ingress/controller $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/$IMAGE:$CI_COMMIT_SHA
- docker tag varnish-ingress/controller $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/$IMAGE:latest
- docker push $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/$IMAGE:$CI_COMMIT_SHA
- docker push $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/$IMAGE:latest
integration: integration:
needs: ["build:controller"] needs: ["build:controller"]
...@@ -78,31 +68,38 @@ integration: ...@@ -78,31 +68,38 @@ integration:
- kubectl get services --all-namespaces -o wide - kubectl get services --all-namespaces -o wide
script: script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY - 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 - 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 # 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 pull $CI_REGISTRY_IMAGE/varnish-ingress/varnish:latest
- docker tag $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/controller:$CI_COMMIT_SHA varnish-ingress/controller - docker tag $CI_REGISTRY_IMAGE/varnish-ingress/controller:$CI_COMMIT_SHA varnish-ingress/controller
- docker tag $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/varnish:latest varnish-ingress/varnish - docker tag $CI_REGISTRY_IMAGE/varnish-ingress/varnish:latest varnish-ingress/varnish
- kind load docker-image varnish-ingress/varnish - kind load docker-image varnish-ingress/varnish
- kind load docker-image varnish-ingress/controller - kind load docker-image varnish-ingress/controller
- test/e2e.sh - test/e2e.sh
# basic step for a pipeline to build the varnish image # basic step for a pipeline to build the varnish image
.build-varnish: .build-varnish:
extends: .build-image
stage: build stage: build
image: docker:19.03.8
services:
- docker:19.03.8-dind
variables: variables:
IMAGE: varnish IMAGE: varnish
before_script:
- apk add -U make
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
script: script:
- docker pull $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/varnish-ingress/$IMAGE:latest || true
- cd container - cd container
- make varnish - make varnish
- docker tag varnish-ingress/$IMAGE $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/$IMAGE:$CI_COMMIT_SHA
- docker tag varnish-ingress/$IMAGE $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/$IMAGE:latest .build-image:
- docker push $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/$IMAGE:$CI_COMMIT_SHA stage: build
- docker push $CI_REGISTRY/timleers/k8s-ingress/varnish-ingress/$IMAGE:latest image: docker:19.03.8
services:
- docker:19.03.8-dind
variables:
IMAGE: BASIC
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/varnish-ingress/$IMAGE:latest || 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:latest
- docker push $CI_REGISTRY_IMAGE/varnish-ingress/$IMAGE:$CI_COMMIT_SHA
- docker push $CI_REGISTRY_IMAGE/varnish-ingress/$IMAGE:latest
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