summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitrios Markou <dm844v@att.com>2018-11-26 14:56:04 -0600
committerDimitrios Markou <dm844v@att.com>2018-11-26 16:34:45 -0600
commit63230b9f6b9fd10530bf1993f5d45ed7568a9450 (patch)
treed366763dd6691eb6d7b0dc666c8b722e4f78c93c
parent9c2ca300016e5603175004026ca45e9c43c0994f (diff)
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>
Notes
Notes (review): Code-Review+2: Bryan Strassner <bryan.strassner@gmail.com> Code-Review+2: Scott Hussey <sthussey@att.com> Code-Review+1: Ahmad Mahmoudi <am495p@att.com> Workflow+1: Scott Hussey <sthussey@att.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 27 Nov 2018 15:31:05 +0000 Reviewed-on: https://review.openstack.org/620153 Project: openstack/airship-divingbell Branch: refs/heads/master
-rw-r--r--Makefile19
-rwxr-xr-xtools/helm_install.sh44
-rwxr-xr-xtools/helm_tk.sh13
3 files changed, 67 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 98932eb..6366364 100644
--- a/Makefile
+++ b/Makefile
@@ -12,12 +12,15 @@
12# See the License for the specific language governing permissions and 12# See the License for the specific language governing permissions and
13# limitations under the License. 13# limitations under the License.
14 14
15HELM := helm 15BUILD_DIR := $(shell mkdir -p build && mktemp -d -p build)
16TASK := build 16HELM := $(shell realpath $(BUILD_DIR))/helm
17TASK := build
17 18
18EXCLUDES := helm-toolkit docs tests tools logs 19EXCLUDES := helm-toolkit docs tests tools logs
19CHARTS := $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.))) 20CHARTS := $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.)))
20CHART := divingbell 21CHART := divingbell
22
23export
21 24
22all: $(CHART) 25all: $(CHART)
23 26
@@ -26,7 +29,7 @@ $(CHART):
26 @echo "===== Processing [$@] chart =====" 29 @echo "===== Processing [$@] chart ====="
27 @make $(TASK)-$@ 30 @make $(TASK)-$@
28 31
29init-%: clean 32init-%: clean helm-install
30 DEP_UP_LIST=$* tools/helm_tk.sh $(HELM) 33 DEP_UP_LIST=$* tools/helm_tk.sh $(HELM)
31 34
32lint-%: init-% 35lint-%: init-%
@@ -62,3 +65,7 @@ docs: clean build_docs
62.PHONY: build_docs 65.PHONY: build_docs
63build_docs: 66build_docs:
64 tox -e docs 67 tox -e docs
68
69.PHONY: helm-install
70helm-install:
71 tools/helm_install.sh $(HELM)
diff --git a/tools/helm_install.sh b/tools/helm_install.sh
new file mode 100755
index 0000000..e561655
--- /dev/null
+++ b/tools/helm_install.sh
@@ -0,0 +1,44 @@
1#!/bin/bash
2# Copyright 2018 AT&T Intellectual Property. All other rights reserved.
3#
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#
16
17set -x
18
19HELM=$1
20HELM_ARTIFACT_URL=${HELM_ARTIFACT_URL:-"https://storage.googleapis.com/kubernetes-helm/helm-v2.10.0-linux-amd64.tar.gz"}
21
22
23function install_helm_binary {
24 if [[ -z "${HELM}" ]]
25 then
26 echo "No Helm binary target location."
27 exit -1
28 fi
29
30 if [[ -w "$(dirname ${HELM})" ]]
31 then
32 TMP_DIR=${BUILD_DIR:-$(mktemp -d)}
33 curl -o "${TMP_DIR}/helm.tar.gz" "${HELM_ARTIFACT_URL}"
34 pushd ${TMP_DIR}
35 tar -xvzf helm.tar.gz
36 cp "linux-amd64/helm" "helm"
37 popd
38 else
39 echo "Cannot write to ${HELM}"
40 exit -1
41 fi
42}
43
44install_helm_binary
diff --git a/tools/helm_tk.sh b/tools/helm_tk.sh
index 99ac4c0..585c21f 100755
--- a/tools/helm_tk.sh
+++ b/tools/helm_tk.sh
@@ -18,6 +18,8 @@
18HELM=$1 18HELM=$1
19HTK_REPO=${HTK_REPO:-"https://github.com/openstack/openstack-helm-infra"} 19HTK_REPO=${HTK_REPO:-"https://github.com/openstack/openstack-helm-infra"}
20HTK_PATH=${HTK_PATH:-""} 20HTK_PATH=${HTK_PATH:-""}
21HTK_STABLE_COMMIT=${HTK_COMMIT:-"2fce7e821201a5f578331370703e164d5a932fcc"}
22BUILD_DIR=${BUILD_DIR:-$(mktemp -d)}
21DEP_UP_LIST=${DEP_UP_LIST:-"divingbell"} 23DEP_UP_LIST=${DEP_UP_LIST:-"divingbell"}
22 24
23if [[ ! -z $(echo $http_proxy) ]] 25if [[ ! -z $(echo $http_proxy) ]]
@@ -31,7 +33,7 @@ function helm_serve {
31 if [[ -d "$HOME/.helm" ]]; then 33 if [[ -d "$HOME/.helm" ]]; then
32 echo ".helm directory found" 34 echo ".helm directory found"
33 else 35 else
34 ${HELM} init --client-only 36 ${HELM} init --client-only --skip-refresh
35 fi 37 fi
36 if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then 38 if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then
37 ${HELM} serve & > /dev/null 39 ${HELM} serve & > /dev/null
@@ -54,10 +56,15 @@ mkdir -p build
54pushd build 56pushd build
55git clone --depth 1 $HTK_REPO || true 57git clone --depth 1 $HTK_REPO || true
56pushd ${HTK_REPO##*/}/$HTK_PATH 58pushd ${HTK_REPO##*/}/$HTK_PATH
59git reset --hard "${HTK_STABLE_COMMIT}"
57 60
58git pull
59make helm-toolkit
60helm_serve 61helm_serve
62if [[ ${HELM} != "helm" ]]
63then
64 export PATH=${PATH}:$(dirname ${HELM})
65fi
66
67make helm-toolkit
61 68
62popd && popd 69popd && popd
63for c in $DEP_UP_LIST 70for c in $DEP_UP_LIST