From 258225b67a320d3b32937b8598588eda2c886b21 Mon Sep 17 00:00:00 2001
From: Scott Leggett <scott@sl.id.au>
Date: Thu, 14 Dec 2023 13:54:39 +0800
Subject: [PATCH] fix: avoid installing the registry multiple times

While the fill-test-ci-values target's dependency on install-registry
was correctly manipulated by the SKIP_INSTALL_REGISTRY variable, the
install-lagoon-build-deploy target had a hard-coded dependency on
install-registry. The result was that the registry would get installed
multiple times anyway via the fill-test-ci-values target via an indirect
dependency.

Fix that by removing the dependency that install-lagoon-build-deploy has
on install-registry when SKIP_INSTALL_REGISTRY=true.
---
 Makefile | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 64088fcf..16c8ea97 100644
--- a/Makefile
+++ b/Makefile
@@ -261,7 +261,7 @@ install-lagoon-remote: install-lagoon-build-deploy install-lagoon-core install-m
 # Do not install without lagoon-core
 #
 .PHONY: install-lagoon-build-deploy
-install-lagoon-build-deploy: install-lagoon-core install-registry
+install-lagoon-build-deploy: install-lagoon-core
 	$(HELM) dependency build ./charts/lagoon-build-deploy/
 	$(HELM) upgrade \
 		--install \
@@ -288,6 +288,11 @@ install-lagoon-build-deploy: install-lagoon-core install-registry
 		lagoon-build-deploy \
 		./charts/lagoon-build-deploy
 
+# allow skipping registry install for install-lagoon-remote target
+ifneq ($(SKIP_INSTALL_REGISTRY),true)
+install-lagoon-build-deploy: install-registry
+endif
+
 #
 # The following targets facilitate local development only and aren't used in CI.
 #