[Tree-wide] Make chart build process predictible
ONAP is built using plain makefile rules. List of targets is generated
using wildcard function. Based on make changelog:
http://git.savannah.gnu.org/cgit/make.git/tree/NEWS
since version 3.82 wildcard is not going to sort its results which
means that charts are being processed in an arbitrary order which may
lead to build failure due to missing dependencies.
Since version 4.3 make started sorting the wildcard results once again
which may lead to build issues.
To avoid that and make our builds predictible independently from
Makefile version let's make sure that we always sort wildcard results.
Addinally let's use 'file://' instead of '@local' for charts in common
to resolve dependencies between them.
Issue-ID: OOM-2399
Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
Change-Id: Iacb02dcdbd577ce0e9ca1078dd0586d296ec9375
diff --git a/kubernetes/sdnc/Makefile b/kubernetes/sdnc/Makefile
index d634a8c..e4b5dda 100644
--- a/kubernetes/sdnc/Makefile
+++ b/kubernetes/sdnc/Makefile
@@ -18,8 +18,8 @@
PACKAGE_DIR := $(OUTPUT_DIR)/packages
SECRET_DIR := $(OUTPUT_DIR)/secrets
-EXCLUDES :=
-HELM_CHARTS := $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.)))
+EXCLUDES := dist resources templates charts
+HELM_CHARTS := $(filter-out $(EXCLUDES), $(sort $(patsubst %/.,%,$(wildcard */.))))
.PHONY: $(EXCLUDES) $(HELM_CHARTS)
@@ -48,4 +48,4 @@
@rm -f *tgz */charts/*tgz
@rm -rf $(PACKAGE_DIR)
%:
- @:
\ No newline at end of file
+ @:
diff --git a/kubernetes/sdnc/components/Makefile b/kubernetes/sdnc/components/Makefile
new file mode 100644
index 0000000..4e73763
--- /dev/null
+++ b/kubernetes/sdnc/components/Makefile
@@ -0,0 +1,51 @@
+# Copyright © 2017 Amdocs, Bell Canada
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# FIXME OOM-765
+ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
+OUTPUT_DIR := $(ROOT_DIR)/../../dist
+PACKAGE_DIR := $(OUTPUT_DIR)/packages
+SECRET_DIR := $(OUTPUT_DIR)/secrets
+
+EXCLUDES :=
+HELM_CHARTS := $(filter-out $(EXCLUDES), $(sort $(patsubst %/.,%,$(wildcard */.))))
+
+.PHONY: $(EXCLUDES) $(HELM_CHARTS)
+
+all: $(HELM_CHARTS)
+
+$(HELM_CHARTS):
+ @echo "\n[$@]"
+ @make package-$@
+
+make-%:
+ @if [ -f $*/Makefile ]; then make -C $*; fi
+
+dep-%: make-%
+ @if [ -f $*/requirements.yaml ]; then helm dep up $*; fi
+
+lint-%: dep-%
+ @if [ -f $*/Chart.yaml ]; then helm lint $*; fi
+
+package-%: lint-%
+ @mkdir -p $(PACKAGE_DIR)
+ @if [ -f $*/Chart.yaml ]; then helm package -d $(PACKAGE_DIR) $*; fi
+ @helm repo index $(PACKAGE_DIR)
+
+clean:
+ @rm -f */requirements.lock
+ @rm -f *tgz */charts/*tgz
+ @rm -rf $(PACKAGE_DIR)
+%:
+ @:
diff --git a/kubernetes/sdnc/sdnc-prom/Chart.yaml b/kubernetes/sdnc/components/sdnc-prom/Chart.yaml
similarity index 100%
rename from kubernetes/sdnc/sdnc-prom/Chart.yaml
rename to kubernetes/sdnc/components/sdnc-prom/Chart.yaml
diff --git a/kubernetes/sdnc/sdnc-prom/requirements.yaml b/kubernetes/sdnc/components/sdnc-prom/requirements.yaml
similarity index 100%
rename from kubernetes/sdnc/sdnc-prom/requirements.yaml
rename to kubernetes/sdnc/components/sdnc-prom/requirements.yaml
diff --git a/kubernetes/sdnc/sdnc-prom/resources/bin/ensureSdncActive.sh b/kubernetes/sdnc/components/sdnc-prom/resources/bin/ensureSdncActive.sh
similarity index 100%
rename from kubernetes/sdnc/sdnc-prom/resources/bin/ensureSdncActive.sh
rename to kubernetes/sdnc/components/sdnc-prom/resources/bin/ensureSdncActive.sh
diff --git a/kubernetes/sdnc/sdnc-prom/resources/bin/ensureSdncStandby.sh b/kubernetes/sdnc/components/sdnc-prom/resources/bin/ensureSdncStandby.sh
similarity index 100%
rename from kubernetes/sdnc/sdnc-prom/resources/bin/ensureSdncStandby.sh
rename to kubernetes/sdnc/components/sdnc-prom/resources/bin/ensureSdncStandby.sh
diff --git a/kubernetes/sdnc/sdnc-prom/resources/bin/prom.sh b/kubernetes/sdnc/components/sdnc-prom/resources/bin/prom.sh
similarity index 100%
rename from kubernetes/sdnc/sdnc-prom/resources/bin/prom.sh
rename to kubernetes/sdnc/components/sdnc-prom/resources/bin/prom.sh
diff --git a/kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.cluster b/kubernetes/sdnc/components/sdnc-prom/resources/bin/sdnc.cluster
similarity index 100%
rename from kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.cluster
rename to kubernetes/sdnc/components/sdnc-prom/resources/bin/sdnc.cluster
diff --git a/kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.dnsswitch b/kubernetes/sdnc/components/sdnc-prom/resources/bin/sdnc.dnsswitch
similarity index 100%
rename from kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.dnsswitch
rename to kubernetes/sdnc/components/sdnc-prom/resources/bin/sdnc.dnsswitch
diff --git a/kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.failover b/kubernetes/sdnc/components/sdnc-prom/resources/bin/sdnc.failover
similarity index 100%
rename from kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.failover
rename to kubernetes/sdnc/components/sdnc-prom/resources/bin/sdnc.failover
diff --git a/kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.monitor b/kubernetes/sdnc/components/sdnc-prom/resources/bin/sdnc.monitor
similarity index 100%
rename from kubernetes/sdnc/sdnc-prom/resources/bin/sdnc.monitor
rename to kubernetes/sdnc/components/sdnc-prom/resources/bin/sdnc.monitor
diff --git a/kubernetes/sdnc/sdnc-prom/resources/bin/switchVoting.sh b/kubernetes/sdnc/components/sdnc-prom/resources/bin/switchVoting.sh
similarity index 100%
rename from kubernetes/sdnc/sdnc-prom/resources/bin/switchVoting.sh
rename to kubernetes/sdnc/components/sdnc-prom/resources/bin/switchVoting.sh
diff --git a/kubernetes/sdnc/sdnc-prom/resources/config/config.json b/kubernetes/sdnc/components/sdnc-prom/resources/config/config.json
similarity index 100%
rename from kubernetes/sdnc/sdnc-prom/resources/config/config.json
rename to kubernetes/sdnc/components/sdnc-prom/resources/config/config.json
diff --git a/kubernetes/sdnc/sdnc-prom/resources/config/healthchecks.json b/kubernetes/sdnc/components/sdnc-prom/resources/config/healthchecks.json
similarity index 100%
rename from kubernetes/sdnc/sdnc-prom/resources/config/healthchecks.json
rename to kubernetes/sdnc/components/sdnc-prom/resources/config/healthchecks.json
diff --git a/kubernetes/sdnc/sdnc-prom/templates/configmap.yaml b/kubernetes/sdnc/components/sdnc-prom/templates/configmap.yaml
similarity index 100%
rename from kubernetes/sdnc/sdnc-prom/templates/configmap.yaml
rename to kubernetes/sdnc/components/sdnc-prom/templates/configmap.yaml
diff --git a/kubernetes/sdnc/sdnc-prom/templates/deployment.yaml b/kubernetes/sdnc/components/sdnc-prom/templates/deployment.yaml
similarity index 100%
rename from kubernetes/sdnc/sdnc-prom/templates/deployment.yaml
rename to kubernetes/sdnc/components/sdnc-prom/templates/deployment.yaml
diff --git a/kubernetes/sdnc/sdnc-prom/templates/pv.yaml b/kubernetes/sdnc/components/sdnc-prom/templates/pv.yaml
similarity index 100%
rename from kubernetes/sdnc/sdnc-prom/templates/pv.yaml
rename to kubernetes/sdnc/components/sdnc-prom/templates/pv.yaml
diff --git a/kubernetes/sdnc/sdnc-prom/templates/pvc.yaml b/kubernetes/sdnc/components/sdnc-prom/templates/pvc.yaml
similarity index 100%
rename from kubernetes/sdnc/sdnc-prom/templates/pvc.yaml
rename to kubernetes/sdnc/components/sdnc-prom/templates/pvc.yaml
diff --git a/kubernetes/sdnc/sdnc-prom/values.yaml b/kubernetes/sdnc/components/sdnc-prom/values.yaml
similarity index 100%
rename from kubernetes/sdnc/sdnc-prom/values.yaml
rename to kubernetes/sdnc/components/sdnc-prom/values.yaml