1 # Copyright © 2017 Amdocs, Bell Canada
2 # Modification copyright (C) 2021 Nordix Foundation
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
17 COMMON_CHARTS_DIR := common
19 ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
20 OUTPUT_DIR := $(ROOT_DIR)/dist
21 PACKAGE_DIR := $(OUTPUT_DIR)/packages
22 SECRET_DIR := $(OUTPUT_DIR)/secrets
25 HELM_VER := $(shell $(HELM_BIN) version --template "{{.Version}}" 2>/dev/null)
27 # use this if you would like to cm-push onap charts to repo with other name
28 # WARNING: Helm v3+ only
29 # WARNING: Make sure to edit also Chart files
32 ifneq ($(SKIP_LINT),TRUE)
33 HELM_LINT_CMD := $(HELM_BIN) lint
35 HELM_LINT_CMD := echo "Skipping linting of"
39 EXCLUDES := common config oneclick readiness test dist helm $(PARENT_CHART) dcae $(SUBMODS)
40 HELM_CHARTS := $(filter-out $(EXCLUDES), $(sort $(patsubst %/.,%,$(wildcard */.))))
42 .PHONY: $(EXCLUDES) $(HELM_CHARTS) check-for-staging-images
44 all: print_helm_bin $(COMMON_CHARTS_DIR) $(SUBMODS) $(HELM_CHARTS) $(PARENT_CHART) helm-repo-update plugins
50 $(HELM_CHARTS): $(COMMON_CHARTS_DIR)
54 $(SUBMODS): $(COMMON_CHARTS_DIR)
59 $(PARENT_CHART): $(HELM_CHARTS)
67 $(error Submodule $* needs to be retrieved from gerrit. See https://wiki.onap.org/display/DW/OOM+-+Development+workflow+after+code+transfer+to+tech+teams ); fi
70 $(info Using Helm binary ${HELM_BIN} which is helm version ${HELM_VER})
73 @if [ -f $*/Makefile ]; then make -C $*; fi
76 @if [ -f $*/Chart.yaml ]; then $(HELM_BIN) dep up $*; fi
79 @if [ -f $*/Chart.yaml ]; then $(HELM_LINT_CMD) $*; fi
82 @mkdir -p $(PACKAGE_DIR)
83 @if [ -f $*/Chart.yaml ]; then PACKAGE_NAME=$$($(HELM_BIN) package -d $(PACKAGE_DIR) $* | cut -d":" -f2) && $(HELM_BIN) cm-push -f $$PACKAGE_NAME $(HELM_REPO); fi
88 @find . -type f -name '*.tgz' -delete
89 @rm -rf $(PACKAGE_DIR)/*
91 # publish helm plugins via distrubtion directory
93 @mkdir -p $(PACKAGE_DIR)
94 @cp -R helm $(PACKAGE_DIR)/
96 check-for-staging-images:
97 $(ROOT_DIR)/../.ci/check-for-staging-images.sh
99 helm-repo-update: $(PARENT_CHART)
100 @$(HELM_BIN) repo update