summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitrios Markou <dm844v@att.com>2018-11-08 14:18:37 -0600
committerDimitrios Markou <dm844v@att.com>2018-11-13 10:27:38 -0600
commit269589512a62cd930b421e6f792685fa429741b3 (patch)
tree133a7ea250db3bd0b2d5352abdf7eb6e792585d4
parent94df4daeb6b9e31fe8c6f7d4e0ac2745221797bc (diff)
Create Makefile target to install Helm binary
In Makefile there is no target which actually installs Helm binary. Because of that the execution of the "make charts" target fails Story: 2004304 Change-Id: I16687802855e5fef63f69eeb365204fe064996a5 Signed-off-by: Dimitrios Markou <dm844v@att.com>
Notes
Notes (review): Code-Review+2: Scott Hussey <sthussey@att.com> Code-Review+1: Andrey Volkov <av903u@att.com> Code-Review+2: Bryan Strassner <bryan.strassner@gmail.com> Workflow+1: Bryan Strassner <bryan.strassner@gmail.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Wed, 14 Nov 2018 15:28:45 +0000 Reviewed-on: https://review.openstack.org/616686 Project: openstack/airship-armada Branch: refs/heads/master
-rw-r--r--Makefile20
-rwxr-xr-xtools/helm_install.sh43
-rwxr-xr-xtools/helm_tk.sh79
3 files changed, 106 insertions, 36 deletions
diff --git a/Makefile b/Makefile
index 39a63b6..929bde5 100644
--- a/Makefile
+++ b/Makefile
@@ -13,11 +13,12 @@
13# limitations under the License. 13# limitations under the License.
14 14
15# APP INFO 15# APP INFO
16BUILD_DIR := $(shell mktemp -d)
16DOCKER_REGISTRY ?= quay.io 17DOCKER_REGISTRY ?= quay.io
17IMAGE_PREFIX ?= airshipit 18IMAGE_PREFIX ?= airshipit
18IMAGE_NAME ?= armada 19IMAGE_NAME ?= armada
19IMAGE_TAG ?= latest 20IMAGE_TAG ?= latest
20HELM ?= helm 21HELM ?= $(BUILD_DIR)/helm
21PROXY ?= http://proxy.foo.com:8000 22PROXY ?= http://proxy.foo.com:8000
22NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local 23NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
23USE_PROXY ?= false 24USE_PROXY ?= false
@@ -36,6 +37,8 @@ GIT_SHA = $(shell git rev-parse --short HEAD)
36GIT_TAG = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null) 37GIT_TAG = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null)
37GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "dirty" || echo "clean") 38GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "dirty" || echo "clean")
38 39
40HELM_PIDFILE ?= $(abspath ./.helm-pid)
41
39ifdef VERSION 42ifdef VERSION
40 DOCKER_VERSION = $(VERSION) 43 DOCKER_VERSION = $(VERSION)
41endif 44endif
@@ -82,12 +85,6 @@ check-tox:
82.PHONY: images 85.PHONY: images
83images: check-docker build_armada 86images: check-docker build_armada
84 87
85.PHONY: dry-run
86dry-run: clean
87 tools/helm_tk.sh $(HELM)
88 $(HELM) dep up charts/$(CHART)
89 $(HELM) template charts/$(CHART)
90
91.PHONY: docs 88.PHONY: docs
92docs: clean build_docs 89docs: clean build_docs
93 90
@@ -187,7 +184,7 @@ helm-init-%: helm-serve
187 cd charts;if [ -s $*/requirements.yaml ]; then echo "Initializing $*";$(HELM) dep up $*; fi 184 cd charts;if [ -s $*/requirements.yaml ]; then echo "Initializing $*";$(HELM) dep up $*; fi
188 185
189.PHONY: helm-serve 186.PHONY: helm-serve
190helm-serve: 187helm-serve: helm-install
191 ./tools/helm_tk.sh $(HELM) $(HELM_PIDFILE) 188 ./tools/helm_tk.sh $(HELM) $(HELM_PIDFILE)
192 189
193.PHONY: helm-lint 190.PHONY: helm-lint
@@ -199,7 +196,7 @@ helm-lint-%: helm-init-%
199 cd charts;$(HELM) lint $* 196 cd charts;$(HELM) lint $*
200 197
201.PHONY: dry-run 198.PHONY: dry-run
202dry-run: $(addprefix dry-run-,$(CHARTS)) 199dry-run: clean $(addprefix dry-run-,$(CHARTS))
203 200
204.PHONY: dry-run-% 201.PHONY: dry-run-%
205dry-run-%: helm-lint-% 202dry-run-%: helm-lint-%
@@ -209,3 +206,8 @@ dry-run-%: helm-lint-%
209.PHONY: $(CHARTS) 206.PHONY: $(CHARTS)
210$(CHARTS): $(addprefix dry-run-,$(CHARTS)) chartbanner 207$(CHARTS): $(addprefix dry-run-,$(CHARTS)) chartbanner
211 $(HELM) package -d charts charts/$@ 208 $(HELM) package -d charts charts/$@
209
210# Install helm binary
211.PHONY: helm-install
212helm-install:
213 ./tools/helm_install.sh $(HELM)
diff --git a/tools/helm_install.sh b/tools/helm_install.sh
new file mode 100755
index 0000000..e8a2caa
--- /dev/null
+++ b/tools/helm_install.sh
@@ -0,0 +1,43 @@
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 cd ${TMP_DIR}
35 tar -xvzf helm.tar.gz
36 cp "${TMP_DIR}/linux-amd64/helm" "${HELM}"
37 else
38 echo "Cannot write to ${HELM}"
39 exit -1
40 fi
41}
42
43install_helm_binary
diff --git a/tools/helm_tk.sh b/tools/helm_tk.sh
index bf83092..90b5d34 100755
--- a/tools/helm_tk.sh
+++ b/tools/helm_tk.sh
@@ -15,37 +15,62 @@
15# 15#
16# Script to setup helm-toolkit and helm dep up the armada chart 16# Script to setup helm-toolkit and helm dep up the armada chart
17# 17#
18HELM=$1
19 18
20set -x 19set -eux
21 20
22function helm_serve { 21HELM=${1}
23 if [[ -d "$HOME/.helm" ]]; then 22HELM_PIDFILE=${2}
24 echo ".helm directory found" 23SERVE_DIR=$(mktemp -d)
25 else
26 ${HELM} init --client-only
27 fi
28 if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then
29 ${HELM} serve & > /dev/null
30 while [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; do
31 sleep 1
32 echo "Waiting for Helm Repository"
33 done
34 else
35 echo "Helm serve already running"
36 fi
37 24
38 if ${HELM} repo list | grep -q "^stable" ; then 25${HELM} init --client-only
39 ${HELM} repo remove stable 26
27if [[ -s ${HELM_PIDFILE} ]]; then
28 HELM_PID=$(cat "${HELM_PIDFILE}")
29 if ps "${HELM_PID}"; then
30 kill "${HELM_PID}"
31 sleep 0.5
32 if ps "${HELM_PID}"; then
33 echo Failed to terminate Helm, PID = "${HELM_PID}"
34 exit 1
35 fi
40 fi 36 fi
37fi
38
39${HELM} serve & > /dev/null
40HELM_PID=${!}
41echo Started Helm, PID = "${HELM_PID}"
42echo "${HELM_PID}" > "${HELM_PIDFILE}"
43
44set +x
45if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then
46 while [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; do
47 sleep 1
48 echo "Waiting for Helm Repository"
49 done
50else
51 echo "Helm serve already running"
52fi
53set -x
54
55if ${HELM} repo list | grep -q "^stable" ; then
56 ${HELM} repo remove stable
57fi
58
59${HELM} repo add local http://localhost:8879/charts
60
61
62#OSH Makefile is bugged, so ensure helm is in the path
63if [[ ${HELM} != "helm" ]]
64then
65 export PATH=${PATH}:$(dirname ${HELM})
66fi
67
68{
69 cd "${SERVE_DIR}"
70 git clone --depth 1 https://git.openstack.org/openstack/openstack-helm-infra.git || true
71 cd openstack-helm-infra
41 72
42 ${HELM} repo add local http://localhost:8879/charts 73 make helm-toolkit
43} 74}
44 75
45mkdir -p build 76rm -rf "${SERVE_DIR}"
46cd build
47git clone --depth 1 https://git.openstack.org/openstack/openstack-helm-infra.git || true
48cd openstack-helm-infra
49git pull
50helm_serve
51make charts