blob: ca46ad8fe072555fb633369864616e052bbe38d8 [file] [log] [blame]
Mike Elliott003d7292018-03-26 12:28:53 -04001# Copyright © 2017 Amdocs, Bell Canada
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
Mike Elliottae51de82018-02-16 10:48:59 -050015PARENT_CHART := onap
16COMMON_CHARTS_DIR := common
Mike Elliottae51de82018-02-16 10:48:59 -050017# FIXME OOM-765
18ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
19OUTPUT_DIR := $(ROOT_DIR)/dist
20PACKAGE_DIR := $(OUTPUT_DIR)/packages
21SECRET_DIR := $(OUTPUT_DIR)/secrets
Jakub Latusekdb52a6d2020-10-15 15:02:47 +020022HELM_BIN := helm
23HELM_VER := $(shell $(HELM_BIN) version --template "{{.Version}}")
Mike Elliottae51de82018-02-16 10:48:59 -050024
Krzysztof Opasiak2d35b232020-02-21 13:50:42 +010025ifneq ($(SKIP_LINT),TRUE)
Jakub Latusekdb52a6d2020-10-15 15:02:47 +020026 HELM_LINT_CMD := $(HELM_BIN) lint
Krzysztof Opasiak2d35b232020-02-21 13:50:42 +010027else
28 HELM_LINT_CMD := echo "Skipping linting of"
29endif
30
Ubuntu5e0f3402019-12-12 23:01:28 +000031SUBMODS := robot aai
32EXCLUDES := config oneclick readiness test dist helm $(PARENT_CHART) dcae $(SUBMODS)
Mateusz Pilat613343a2020-05-15 12:19:48 +020033HELM_CHARTS := $(filter-out $(EXCLUDES), $(sort $(patsubst %/.,%,$(wildcard */.)))) $(PARENT_CHART)
Mike Elliottae51de82018-02-16 10:48:59 -050034
Jakub Latusek4b4412c2020-10-30 10:32:01 +010035.PHONY: $(EXCLUDES) $(HELM_CHARTS) check-for-staging-images
Mike Elliottae51de82018-02-16 10:48:59 -050036
Ubuntu5e0f3402019-12-12 23:01:28 +000037all: $(COMMON_CHARTS_DIR) $(SUBMODS) $(HELM_CHARTS) plugins
Mandeep Khindaa57d8dd2018-03-09 14:29:37 +000038
Mike Elliott003d7292018-03-26 12:28:53 -040039$(COMMON_CHARTS):
Mandeep Khindaa57d8dd2018-03-09 14:29:37 +000040 @echo "\n[$@]"
41 @make package-$@
42
Mike Elliottae51de82018-02-16 10:48:59 -050043$(HELM_CHARTS):
44 @echo "\n[$@]"
45 @make package-$@
46
Ubuntu5e0f3402019-12-12 23:01:28 +000047$(SUBMODS):
48 @echo "\n[$@]"
49 @make submod-$@
50 @make package-$@
51
52submod-%:
53 @make $*/requirements.yaml
54
55%/requirements.yaml:
56 $(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
57
58
Mike Elliottae51de82018-02-16 10:48:59 -050059make-%:
60 @if [ -f $*/Makefile ]; then make -C $*; fi
61
62dep-%: make-%
Jakub Latusekdb52a6d2020-10-15 15:02:47 +020063 @if [ -f $*/requirements.yaml ]; then $(HELM_BIN) dep up $*; fi
Mike Elliottae51de82018-02-16 10:48:59 -050064
65lint-%: dep-%
Krzysztof Opasiak2d35b232020-02-21 13:50:42 +010066 @if [ -f $*/Chart.yaml ]; then $(HELM_LINT_CMD) $*; fi
Mike Elliottae51de82018-02-16 10:48:59 -050067
68package-%: lint-%
69 @mkdir -p $(PACKAGE_DIR)
Jakub Latusek6a74e0d2020-10-12 11:55:56 +000070ifeq "$(findstring v3,$(HELM_VER))" "v3"
Jakub Latusekdb52a6d2020-10-15 15:02:47 +020071 @if [ -f $*/Chart.yaml ]; then PACKAGE_NAME=$$($(HELM_BIN) package -d $(PACKAGE_DIR) $* | cut -d":" -f2) && $(HELM_BIN) push -f $$PACKAGE_NAME local; fi
Jakub Latusek6a74e0d2020-10-12 11:55:56 +000072else
Jakub Latusekdb52a6d2020-10-15 15:02:47 +020073 @if [ -f $*/Chart.yaml ]; then $(HELM_BIN) package -d $(PACKAGE_DIR) $*; fi
Jakub Latusek6a74e0d2020-10-12 11:55:56 +000074endif
75
Jakub Latusekdb52a6d2020-10-15 15:02:47 +020076 @$(HELM_BIN) repo index $(PACKAGE_DIR)
Mike Elliottae51de82018-02-16 10:48:59 -050077
78clean:
79 @rm -f */requirements.lock
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000080 @find . -type f -name '*.tgz' -delete
Mike Elliottcb047cb2018-03-27 12:34:57 -040081 @rm -rf $(PACKAGE_DIR)/*
Mike Elliott6a84df32018-03-26 09:37:37 -040082
Mike Elliott2034ea72018-11-26 16:41:54 -050083# publish helm plugins via distrubtion directory
84plugins:
Jakub Latusekdb52a6d2020-10-15 15:02:47 +020085 @cp -R $(HELM_BIN) $(PACKAGE_DIR)/
Mike Elliott2034ea72018-11-26 16:41:54 -050086
Mike Elliottcb047cb2018-03-27 12:34:57 -040087# start up a local helm repo to serve up helm chart packages
Mike Elliott6a84df32018-03-26 09:37:37 -040088repo:
89 @mkdir -p $(PACKAGE_DIR)
Jakub Latusekdb52a6d2020-10-15 15:02:47 +020090 @$(HELM_BIN) serve --repo-path $(PACKAGE_DIR) &
Krzysztof Opasiak21731c92020-07-22 14:02:03 +020091 @sleep 3
Jakub Latusekdb52a6d2020-10-15 15:02:47 +020092 @$(HELM_BIN) repo index $(PACKAGE_DIR)
93 @$(HELM_BIN) repo add local http://127.0.0.1:8879
Mike Elliottcb047cb2018-03-27 12:34:57 -040094
95# stop local helm repo
96repo-stop:
Jakub Latusekdb52a6d2020-10-15 15:02:47 +020097 @pkill $(HELM_BIN)
98 @$(HELM_BIN) repo remove local
Jakub Latusek4b4412c2020-10-30 10:32:01 +010099
100check-for-staging-images:
101 $(ROOT_DIR)/contrib/tools/check-for-staging-images.sh
102
Mike Elliottae51de82018-02-16 10:48:59 -0500103%:
Mike Elliott13fed112018-02-28 08:33:33 -0500104 @:
Jakub Latusek4b4412c2020-10-30 10:32:01 +0100105