From 13ac2b6959b3413af0be29a4b800ba8e86683195 Mon Sep 17 00:00:00 2001 From: Philippe Caseiro Date: Mon, 19 Jun 2023 15:55:07 +0200 Subject: [PATCH] fup --- Makefile | 4 +++- main.mk | 9 ++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index fce1e81..8dc52f5 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,11 @@ # Makefile for Cadoles SP ################################ -IMAGE_REPO := reg.cadoles.com/cadoles +IMAGE_REPO ?= reg.cadoles.com/cadoles IMAGE_VERSION ?= 0.0.1 DAY_SUFFIX_TAG ?= $(shell date +%Y%m%d) +COMMIT_ID ?= $(shell git rev-parse --short --verify HEAD) + include main.mk diff --git a/main.mk b/main.mk index 3327adc..a61d0c8 100644 --- a/main.mk +++ b/main.mk @@ -28,12 +28,12 @@ define install_trivy endef define release_image - docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-$(DAY_SUFFIX_TAG) ; \ + docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-$(COMMIT_ID) ; \ docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:$(IMAGE_VERSION); \ docker tag $(IMAGE_REPO)/$1:$(IMAGE_VERSION) $(IMAGE_REPO)/$1:latest ; \ docker push $(IMAGE_REPO)/$1:latest ; \ docker push $(IMAGE_REPO)/$1:$(IMAGE_VERSION) ; \ - docker push $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-$(DAY_SUFFIX_TAG) + docker push $(IMAGE_REPO)/$1:$(IMAGE_VERSION)-$(COMMIT_ID) endef #list: @@ -57,9 +57,12 @@ release: ${IMAGES_DIR}/* @for name in $(basename $(notdir $^)); do \ $(call release_image,$${name},base); \ done;\ + git tag -f -a $(IMAGE_VERSION) -m "Version $(IMAGE_VERSION) released"; \ + git tag -f -a $(IMAGE_VERSION)-$(COMMIT_ID) -m "Version $(IMAGE_VERSION)-$(COMMIT_ID) released"; \ + git tag -f -a $(IMAGE_VERSION)-latest -m "Version $(IMAGE_VERSION)-latest released"; \ _release: - docker tag $(IMAGE_FULL_NAME):$(IMAGE_TAG) $(IMAGE_FULL_NAME):$(IMAGE_TAG)-$(IMAGE_VERSION)-$(DAY_SUFFIX_TAG) + docker tag $(IMAGE_FULL_NAME):$(IMAGE_TAG) $(IMAGE_FULL_NAME):$(IMAGE_TAG)-$(IMAGE_VERSION)-$(COMMIT_ID) docker tag $(IMAGE_FULL_NAME):$(IMAGE_TAG) $(IMAGE_FULL_NAME):$(IMAGE_TAG)-$(IMAGE_VERSION) docker tag $(IMAGE_FULL_NAME):$(IMAGE_TAG) $(IMAGE_FULL_NAME):$(IMAGE_TAG)-latest docker push $(IMAGE_FULL_NAME):$(IMAGE_TAG)-$(IMAGE_VERSION)-$(DAY_SUFFIX_TAG)