From 779428063ffa276104d91b4501e5bf3a81a3cc93 Mon Sep 17 00:00:00 2001 From: Spolti Date: Tue, 7 Apr 2020 13:28:11 -0300 Subject: [PATCH] [KOGITO-1673] - Operator should not take care of which micro version of images to deploy (#124) Signed-off-by: spolti --- Makefile | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 885b3a8ae3f..27e6093e5da 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ IMAGE_VERSION := $(shell cat image.yaml | egrep ^version | cut -d"\"" -f2) +SHORTENED_LATEST_VERSION := $(shell echo $(IMAGE_VERSION) | awk -F. '{print $$1"."$$2}') BUILD_ENGINE := docker .DEFAULT_GOAL := build @@ -8,27 +9,51 @@ build: kogito-quarkus-ubi8 kogito-quarkus-jvm-ubi8 kogito-quarkus-ubi8-s2i kogit kogito-quarkus-ubi8: cekit -v build --overrides-file kogito-quarkus-overrides.yaml ${BUILD_ENGINE} +ifneq ($(findstring "rc",$(IMAGE_VERSION)),"rc") + ${BUILD_ENGINE} tag quay.io/kiegroup/kogito-quarkus-ubi8:${IMAGE_VERSION} quay.io/kiegroup/kogito-quarkus-ubi8:${SHORTENED_LATEST_VERSION} +endif kogito-quarkus-jvm-ubi8: cekit -v build --overrides-file kogito-quarkus-jvm-overrides.yaml ${BUILD_ENGINE} +ifneq ($(findstring "rc",$(IMAGE_VERSION)),"rc") + ${BUILD_ENGINE} tag quay.io/kiegroup/kogito-quarkus-jvm-ubi8:${IMAGE_VERSION} quay.io/kiegroup/kogito-quarkus-jvm-ubi8:${SHORTENED_LATEST_VERSION} +endif kogito-quarkus-ubi8-s2i: cekit -v build --overrides-file kogito-quarkus-s2i-overrides.yaml ${BUILD_ENGINE} +ifneq ($(findstring "rc",$(IMAGE_VERSION)),"rc") + ${BUILD_ENGINE} tag quay.io/kiegroup/kogito-quarkus-ubi8-s2i:${IMAGE_VERSION} quay.io/kiegroup/kogito-quarkus-ubi8-s2i:${SHORTENED_LATEST_VERSION} +endif kogito-springboot-ubi8: cekit -v build --overrides-file kogito-springboot-overrides.yaml ${BUILD_ENGINE} +ifneq ($(findstring "rc",$(IMAGE_VERSION)),"rc") + ${BUILD_ENGINE} tag quay.io/kiegroup/kogito-springboot-ubi8:${IMAGE_VERSION} quay.io/kiegroup/kogito-springboot-ubi8:${SHORTENED_LATEST_VERSION} +endif kogito-springboot-ubi8-s2i: cekit -v build --overrides-file kogito-springboot-s2i-overrides.yaml ${BUILD_ENGINE} +ifneq ($(findstring "rc",$(IMAGE_VERSION)),"rc") + ${BUILD_ENGINE} tag quay.io/kiegroup/kogito-springboot-ubi8-s2i:${IMAGE_VERSION} quay.io/kiegroup/kogito-springboot-ubi8-s2i:${SHORTENED_LATEST_VERSION} +endif kogito-data-index: cekit -v build --overrides-file kogito-data-index-overrides.yaml ${BUILD_ENGINE} +ifneq ($(findstring "rc",$(IMAGE_VERSION)),"rc") + ${BUILD_ENGINE} tag quay.io/kiegroup/kogito-data-index:${IMAGE_VERSION} quay.io/kiegroup/kogito-data-index:${SHORTENED_LATEST_VERSION} +endif kogito-jobs-service: cekit -v build --overrides-file kogito-jobs-service-overrides.yaml ${BUILD_ENGINE} +ifneq ($(findstring "rc",$(IMAGE_VERSION)),"rc") + ${BUILD_ENGINE} tag quay.io/kiegroup/kogito-jobs-service:${IMAGE_VERSION} quay.io/kiegroup/kogito-jobs-service:${SHORTENED_LATEST_VERSION} +endif kogito-management-console: cekit -v build --overrides-file kogito-management-console-overrides.yaml ${BUILD_ENGINE} +ifneq ($(findstring "rc",$(IMAGE_VERSION)),"rc") + ${BUILD_ENGINE} tag quay.io/kiegroup/kogito-management-console:${IMAGE_VERSION} quay.io/kiegroup/kogito-management-console:${SHORTENED_LATEST_VERSION} +endif # Build and test all images .PHONY: test @@ -48,9 +73,9 @@ test: .PHONY: push push: build _push _push: - docker push quay.io/kiegroup/kogito-quarkus-ubi8:$(IMAGE_VERSION) + docker push quay.io/kiegroup/kogito-quarkus-ubi8:${IMAGE_VERSION} docker push quay.io/kiegroup/kogito-quarkus-ubi8:latest - docker push quay.io/kiegroup/kogito-quarkus-jvm-ubi8:$(IMAGE_VERSION) + docker push quay.io/kiegroup/kogito-quarkus-jvm-ubi8:${IMAGE_VERSION} docker push quay.io/kiegroup/kogito-quarkus-jvm-ubi8:latest docker push quay.io/kiegroup/kogito-quarkus-ubi8-s2i:${IMAGE_VERSION} docker push quay.io/kiegroup/kogito-quarkus-ubi8-s2i:latest @@ -64,6 +89,17 @@ _push: docker push quay.io/kiegroup/kogito-jobs-service:latest docker push quay.io/kiegroup/kogito-management-console:${IMAGE_VERSION} docker push quay.io/kiegroup/kogito-management-console:latest +ifneq ($(findstring "rc",$(IMAGE_VERSION)),"rc") + @echo "${SHORTENED_LATEST_VERSION} will be pushed" + docker push quay.io/kiegroup/kogito-quarkus-ubi8:${SHORTENED_LATEST_VERSION} + docker push quay.io/kiegroup/kogito-quarkus-jvm-ubi8:${SHORTENED_LATEST_VERSION} + docker push quay.io/kiegroup/kogito-quarkus-ubi8-s2i:${SHORTENED_LATEST_VERSION} + docker push quay.io/kiegroup/kogito-springboot-ubi8:${SHORTENED_LATEST_VERSION} + docker push quay.io/kiegroup/kogito-springboot-ubi8-s2i:${SHORTENED_LATEST_VERSION} + docker push quay.io/kiegroup/kogito-data-index:${SHORTENED_LATEST_VERSION} + docker push quay.io/kiegroup/kogito-jobs-service:${SHORTENED_LATEST_VERSION} + docker push quay.io/kiegroup/kogito-management-console:${SHORTENED_LATEST_VERSION} +endif # push staging images to quay.io, done before release, this requires permissions under kiegroup organization