From 3dfa2abd14f37eae00fc340fb54eddc6d4b523e5 Mon Sep 17 00:00:00 2001 From: Jean-Francois Chevrette Date: Fri, 20 Dec 2024 10:48:00 -0500 Subject: [PATCH] make deploy should use provided COMMIT as tag or use the most recent tag COMMIT is provided in the confif file for any environment that is not development. For these, the behavior do not change If COMMIT is not provided, we query azure ACR for the most recent tag and use that. --- backend/Makefile | 10 ++++++---- frontend/Makefile | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/backend/Makefile b/backend/Makefile index ce689a792d..e9f0eb60ab 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -1,10 +1,12 @@ -include ../setup-env.mk -ifndef COMMIT -COMMIT := $(shell git rev-parse --short=7 HEAD) +ARO_HCP_REGISTRY ?= ${ARO_HCP_IMAGE_ACR}.azurecr.io +ARO_HCP_REPOSITORY := arohcpbackend + +ifeq ($(strip $(COMMIT)),) +COMMIT := $(shell az acr repository show-tags --name ${ARO_HCP_IMAGE_ACR} --repository ${ARO_HCP_REPOSITORY} --orderby time_desc --top 1 --output tsv) endif -ARO_HCP_BASE_IMAGE ?= ${ARO_HCP_IMAGE_ACR}.azurecr.io -ARO_HCP_BACKEND_IMAGE ?= $(ARO_HCP_BASE_IMAGE)/arohcpbackend:$(COMMIT) +ARO_HCP_BACKEND_IMAGE ?= $(ARO_HCP_REGISTRY)/$(ARO_HCP_REPOSITORY):$(COMMIT) .DEFAULT_GOAL := backend diff --git a/frontend/Makefile b/frontend/Makefile index 27a7d5b863..d3b107b95d 100644 --- a/frontend/Makefile +++ b/frontend/Makefile @@ -1,10 +1,12 @@ -include ../setup-env.mk -ifndef COMMIT -COMMIT := $(shell git rev-parse --short=7 HEAD) +ARO_HCP_REGISTRY ?= ${ARO_HCP_IMAGE_ACR}.azurecr.io +ARO_HCP_REPOSITORY := arohcpfrontend + +ifeq ($(strip $(COMMIT)),) +COMMIT := $(shell az acr repository show-tags --name ${ARO_HCP_IMAGE_ACR} --repository ${ARO_HCP_REPOSITORY} --orderby time_desc --top 1 --output tsv) endif -ARO_HCP_BASE_IMAGE ?= ${ARO_HCP_IMAGE_ACR}.azurecr.io -ARO_HCP_FRONTEND_IMAGE ?= $(ARO_HCP_BASE_IMAGE)/arohcpfrontend:$(COMMIT) +ARO_HCP_FRONTEND_IMAGE ?= $(ARO_HCP_REGISTRY)/$(ARO_HCP_REPOSITORY):$(COMMIT) .DEFAULT_GOAL := frontend