Create Makefile target to install Helm binary

In Makefile there is no target which actually installs
Helm binary.

Change-Id: Idca3ed4d0c6d8734b7b6bcfc9d8a1ba9e50693ee
Signed-off-by: Dimitrios Markou <dm844v@att.com>
This commit is contained in:
Dimitrios Markou 2018-11-26 14:56:04 -06:00
parent 9c2ca30001
commit 63230b9f6b
3 changed files with 67 additions and 9 deletions

View File

@ -12,12 +12,15 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
HELM := helm BUILD_DIR := $(shell mkdir -p build && mktemp -d -p build)
TASK := build HELM := $(shell realpath $(BUILD_DIR))/helm
TASK := build
EXCLUDES := helm-toolkit docs tests tools logs EXCLUDES := helm-toolkit docs tests tools logs
CHARTS := $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.))) CHARTS := $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.)))
CHART := divingbell CHART := divingbell
export
all: $(CHART) all: $(CHART)
@ -26,7 +29,7 @@ $(CHART):
@echo "===== Processing [$@] chart =====" @echo "===== Processing [$@] chart ====="
@make $(TASK)-$@ @make $(TASK)-$@
init-%: clean init-%: clean helm-install
DEP_UP_LIST=$* tools/helm_tk.sh $(HELM) DEP_UP_LIST=$* tools/helm_tk.sh $(HELM)
lint-%: init-% lint-%: init-%
@ -62,3 +65,7 @@ docs: clean build_docs
.PHONY: build_docs .PHONY: build_docs
build_docs: build_docs:
tox -e docs tox -e docs
.PHONY: helm-install
helm-install:
tools/helm_install.sh $(HELM)

44
tools/helm_install.sh Executable file
View File

@ -0,0 +1,44 @@
#!/bin/bash
# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
#
# 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.
#
set -x
HELM=$1
HELM_ARTIFACT_URL=${HELM_ARTIFACT_URL:-"https://storage.googleapis.com/kubernetes-helm/helm-v2.10.0-linux-amd64.tar.gz"}
function install_helm_binary {
if [[ -z "${HELM}" ]]
then
echo "No Helm binary target location."
exit -1
fi
if [[ -w "$(dirname ${HELM})" ]]
then
TMP_DIR=${BUILD_DIR:-$(mktemp -d)}
curl -o "${TMP_DIR}/helm.tar.gz" "${HELM_ARTIFACT_URL}"
pushd ${TMP_DIR}
tar -xvzf helm.tar.gz
cp "linux-amd64/helm" "helm"
popd
else
echo "Cannot write to ${HELM}"
exit -1
fi
}
install_helm_binary

View File

@ -18,6 +18,8 @@
HELM=$1 HELM=$1
HTK_REPO=${HTK_REPO:-"https://github.com/openstack/openstack-helm-infra"} HTK_REPO=${HTK_REPO:-"https://github.com/openstack/openstack-helm-infra"}
HTK_PATH=${HTK_PATH:-""} HTK_PATH=${HTK_PATH:-""}
HTK_STABLE_COMMIT=${HTK_COMMIT:-"2fce7e821201a5f578331370703e164d5a932fcc"}
BUILD_DIR=${BUILD_DIR:-$(mktemp -d)}
DEP_UP_LIST=${DEP_UP_LIST:-"divingbell"} DEP_UP_LIST=${DEP_UP_LIST:-"divingbell"}
if [[ ! -z $(echo $http_proxy) ]] if [[ ! -z $(echo $http_proxy) ]]
@ -31,7 +33,7 @@ function helm_serve {
if [[ -d "$HOME/.helm" ]]; then if [[ -d "$HOME/.helm" ]]; then
echo ".helm directory found" echo ".helm directory found"
else else
${HELM} init --client-only ${HELM} init --client-only --skip-refresh
fi fi
if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then
${HELM} serve & > /dev/null ${HELM} serve & > /dev/null
@ -54,10 +56,15 @@ mkdir -p build
pushd build pushd build
git clone --depth 1 $HTK_REPO || true git clone --depth 1 $HTK_REPO || true
pushd ${HTK_REPO##*/}/$HTK_PATH pushd ${HTK_REPO##*/}/$HTK_PATH
git reset --hard "${HTK_STABLE_COMMIT}"
git pull
make helm-toolkit
helm_serve helm_serve
if [[ ${HELM} != "helm" ]]
then
export PATH=${PATH}:$(dirname ${HELM})
fi
make helm-toolkit
popd && popd popd && popd
for c in $DEP_UP_LIST for c in $DEP_UP_LIST