From 6a5335b413c287baa3dbd6b59db597a9a9e25b16 Mon Sep 17 00:00:00 2001
From: Tin Lam <tin@irrational.io>
Date: Sun, 24 Jan 2021 12:14:03 -0600
Subject: [PATCH] fix(make): updates makefile

This patch addresses a few issues with the Makefile

- removes redundant directory checks;
- removes requirements.yaml check as helm3 moved that into Charts.yaml;
- fixes so "helm dep up" would work;
- removes loki and harbor from exclusion as they are now actual charts;
- updates the script to use the makefile.

Signed-off-by: Tin Lam <tin@irrational.io>
Change-Id: Ie6133bce4a45dd085569c51abc4c4c3c52b14378
---
 charts/Makefile                        | 8 ++++----
 charts/harbor/Chart.yaml               | 2 +-
 tools/gate/jarvis/300-deploy-loki.sh   | 4 +---
 tools/gate/jarvis/400-deploy-harbor.sh | 4 +---
 4 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/charts/Makefile b/charts/Makefile
index 235740b8..0d50c589 100644
--- a/charts/Makefile
+++ b/charts/Makefile
@@ -16,7 +16,7 @@ TASK  := build
 
 EXCLUDES := playbooks roles doc tests tools logs tmp zuul.d releasenotes
 # NOTE(Portdirect): Exlude chart directories that are presnt only for the purposes of housing over-rides
-EXCLUDES += harbor loki gerrit ldap
+EXCLUDES += gerrit ldap
 CHARTS := $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.)))
 
 .PHONY: $(EXCLUDES) $(CHARTS)
@@ -32,13 +32,13 @@ $(CHARTS):
 
 init-%:
 	if [ -f $*/Makefile ]; then make -C $*; fi
-	if [ -f $*/requirements.yaml ]; then helm dep up $*; fi
+	helm dependency update $*
 
 lint-%: init-%
-	if [ -d $* ]; then helm lint $*; fi
+	helm lint $*
 
 build-%: lint-%
-	if [ -d $* ]; then helm package $*; fi
+	helm package $*
 
 clean:
 	@echo "Clean all build artifacts"
diff --git a/charts/harbor/Chart.yaml b/charts/harbor/Chart.yaml
index 65bf6cdb..143743ee 100644
--- a/charts/harbor/Chart.yaml
+++ b/charts/harbor/Chart.yaml
@@ -1,5 +1,5 @@
 apiVersion: v2
-name: harbor-utils
+name: harbor
 description: Harbor utility chart
 type: application
 version: 0.1.0
diff --git a/tools/gate/jarvis/300-deploy-loki.sh b/tools/gate/jarvis/300-deploy-loki.sh
index 13aa0c4e..f6e28457 100755
--- a/tools/gate/jarvis/300-deploy-loki.sh
+++ b/tools/gate/jarvis/300-deploy-loki.sh
@@ -1,9 +1,7 @@
 #!/bin/bash
 set -ex
 
-cd ./charts/loki
-helm dep up
-cd -
+make -C ./charts loki
 
 # shellcheck disable=SC2046
 helm upgrade \
diff --git a/tools/gate/jarvis/400-deploy-harbor.sh b/tools/gate/jarvis/400-deploy-harbor.sh
index 2a58c609..3abf6095 100755
--- a/tools/gate/jarvis/400-deploy-harbor.sh
+++ b/tools/gate/jarvis/400-deploy-harbor.sh
@@ -1,9 +1,7 @@
 #!/bin/bash
 set -ex
 
-cd ./charts/harbor
-helm dep up
-cd -
+make -C ./charts harbor
 
 # shellcheck disable=SC2046
 helm upgrade \