blob: f96a32a4f0a257fc9e335085537c35184021c997 [file] [log] [blame]
Mike Elliott003d7292018-03-26 12:28:53 -04001# Copyright © 2017 Amdocs, Bell Canada
efiacor370c6dc2021-10-12 14:10:49 +01002# Modification copyright (C) 2021 Nordix Foundation
Mike Elliott003d7292018-03-26 12:28:53 -04003#
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
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
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.
15
Mike Elliottae51de82018-02-16 10:48:59 -050016PARENT_CHART := onap
17COMMON_CHARTS_DIR := common
Mike Elliottae51de82018-02-16 10:48:59 -050018# FIXME OOM-765
19ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
20OUTPUT_DIR := $(ROOT_DIR)/dist
21PACKAGE_DIR := $(OUTPUT_DIR)/packages
22SECRET_DIR := $(OUTPUT_DIR)/secrets
Jakub Latusekdb52a6d2020-10-15 15:02:47 +020023HELM_BIN := helm
Krzysztof Opasiak2a4b47f2021-02-18 19:09:00 +010024
Krzysztof Opasiak2a4b47f2021-02-18 19:09:00 +010025HELM_VER := $(shell $(HELM_BIN) version --template "{{.Version}}" 2>/dev/null)
Krzysztof Opasiak2a4b47f2021-02-18 19:09:00 +010026
Krzysztof Opasiakfa83b9c2020-11-06 19:33:47 +010027# use this if you would like to push onap charts to repo with other name
28# WARNING: Helm v3+ only
efiacor370c6dc2021-10-12 14:10:49 +010029# WARNING: Make sure to edit also Chart files
Krzysztof Opasiakfa83b9c2020-11-06 19:33:47 +010030HELM_REPO := local
Mike Elliottae51de82018-02-16 10:48:59 -050031
Krzysztof Opasiak2d35b232020-02-21 13:50:42 +010032ifneq ($(SKIP_LINT),TRUE)
Jakub Latusekdb52a6d2020-10-15 15:02:47 +020033 HELM_LINT_CMD := $(HELM_BIN) lint
Krzysztof Opasiak2d35b232020-02-21 13:50:42 +010034else
35 HELM_LINT_CMD := echo "Skipping linting of"
36endif
37
Sylvain Desbureaux70070412020-11-09 21:58:48 +010038SUBMODS := robot
Ubuntu5e0f3402019-12-12 23:01:28 +000039EXCLUDES := config oneclick readiness test dist helm $(PARENT_CHART) dcae $(SUBMODS)
Mateusz Pilat613343a2020-05-15 12:19:48 +020040HELM_CHARTS := $(filter-out $(EXCLUDES), $(sort $(patsubst %/.,%,$(wildcard */.)))) $(PARENT_CHART)
Mike Elliottae51de82018-02-16 10:48:59 -050041
Jakub Latusek4b4412c2020-10-30 10:32:01 +010042.PHONY: $(EXCLUDES) $(HELM_CHARTS) check-for-staging-images
Mike Elliottae51de82018-02-16 10:48:59 -050043
Sylvain Desbureaux00d473f2021-02-15 16:16:23 +010044all: print_helm_bin $(COMMON_CHARTS_DIR) $(SUBMODS) $(HELM_CHARTS) helm-repo-update plugins
Mandeep Khindaa57d8dd2018-03-09 14:29:37 +000045
Mike Elliott003d7292018-03-26 12:28:53 -040046$(COMMON_CHARTS):
Mandeep Khindaa57d8dd2018-03-09 14:29:37 +000047 @echo "\n[$@]"
48 @make package-$@
49
Mike Elliottae51de82018-02-16 10:48:59 -050050$(HELM_CHARTS):
51 @echo "\n[$@]"
52 @make package-$@
53
Ubuntu5e0f3402019-12-12 23:01:28 +000054$(SUBMODS):
55 @echo "\n[$@]"
56 @make submod-$@
57 @make package-$@
58
59submod-%:
efiacor370c6dc2021-10-12 14:10:49 +010060 @make $*/Chart.yaml
Ubuntu5e0f3402019-12-12 23:01:28 +000061
efiacor370c6dc2021-10-12 14:10:49 +010062%/Chart.yaml:
Ubuntu5e0f3402019-12-12 23:01:28 +000063 $(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
64
Sylvain Desbureaux00d473f2021-02-15 16:16:23 +010065print_helm_bin:
66 $(info Using Helm binary ${HELM_BIN} which is helm version ${HELM_VER})
Ubuntu5e0f3402019-12-12 23:01:28 +000067
Mike Elliottae51de82018-02-16 10:48:59 -050068make-%:
69 @if [ -f $*/Makefile ]; then make -C $*; fi
70
71dep-%: make-%
efiacor370c6dc2021-10-12 14:10:49 +010072 @if [ -f $*/Chart.yaml ]; then $(HELM_BIN) dep up $*; fi
Mike Elliottae51de82018-02-16 10:48:59 -050073
74lint-%: dep-%
Krzysztof Opasiak2d35b232020-02-21 13:50:42 +010075 @if [ -f $*/Chart.yaml ]; then $(HELM_LINT_CMD) $*; fi
Mike Elliottae51de82018-02-16 10:48:59 -050076
77package-%: lint-%
78 @mkdir -p $(PACKAGE_DIR)
Krzysztof Opasiakfa83b9c2020-11-06 19:33:47 +010079 @if [ -f $*/Chart.yaml ]; then PACKAGE_NAME=$$($(HELM_BIN) package -d $(PACKAGE_DIR) $* | cut -d":" -f2) && $(HELM_BIN) push -f $$PACKAGE_NAME $(HELM_REPO); fi
Mike Elliottae51de82018-02-16 10:48:59 -050080
81clean:
efiacor370c6dc2021-10-12 14:10:49 +010082 @rm -f */Chart.lock
Dominic Lunanuovae825fee2018-04-12 14:40:34 +000083 @find . -type f -name '*.tgz' -delete
Mike Elliottcb047cb2018-03-27 12:34:57 -040084 @rm -rf $(PACKAGE_DIR)/*
Mike Elliott6a84df32018-03-26 09:37:37 -040085
Mike Elliott2034ea72018-11-26 16:41:54 -050086# publish helm plugins via distrubtion directory
87plugins:
Sylvain Desbureauxa0b1fb12021-01-05 13:24:49 +010088 @cp -R helm $(PACKAGE_DIR)/
Mike Elliott2034ea72018-11-26 16:41:54 -050089
Jakub Latusek4b4412c2020-10-30 10:32:01 +010090check-for-staging-images:
91 $(ROOT_DIR)/contrib/tools/check-for-staging-images.sh
92
Krzysztof Opasiakfa83b9c2020-11-06 19:33:47 +010093helm-repo-update:
Bartek Grzybowski380f9b82020-11-24 14:13:48 +010094 @$(HELM_BIN) repo update
Krzysztof Opasiakfa83b9c2020-11-06 19:33:47 +010095
Mike Elliottae51de82018-02-16 10:48:59 -050096%:
Mike Elliott13fed112018-02-28 08:33:33 -050097 @: