summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.openstack.org>2018-11-13 17:24:35 +0000
committerGerrit Code Review <review@openstack.org>2018-11-13 17:24:35 +0000
commitd0dd0c6a56a4646fa6382256df3d5b20956ef6d7 (patch)
tree7eb0a579b78bf92d105bd6bfb56aa866f9a39ca7
parentc240af18d7af8c3d678bd4f37f88e795f79bf727 (diff)
parentf884d248d1d0a6341d3042deaff142506fbb0c91 (diff)
Merge "Create Makefile target to install Helm binary"
-rw-r--r--Makefile17
-rwxr-xr-xtools/helm_install.sh44
-rwxr-xr-xtools/helm_tk.sh31
3 files changed, 83 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 2b13723..e513c7d 100644
--- a/Makefile
+++ b/Makefile
@@ -12,11 +12,12 @@
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
15BUILD_DIR := $(shell mkdir -p build && mktemp -d -p build)
15DOCKER_REGISTRY ?= quay.io 16DOCKER_REGISTRY ?= quay.io
16IMAGE_NAME ?= deckhand 17IMAGE_NAME ?= deckhand
17IMAGE_PREFIX ?= airshipit 18IMAGE_PREFIX ?= airshipit
18IMAGE_TAG ?= latest 19IMAGE_TAG ?= latest
19HELM ?= helm 20HELM := $(shell realpath $(BUILD_DIR))/helm
20PROXY ?= http://proxy.foo.com:8000 21PROXY ?= http://proxy.foo.com:8000
21NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local 22NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
22USE_PROXY ?= false 23USE_PROXY ?= false
@@ -26,16 +27,28 @@ LABEL ?= org.airshipit.build=community
26COMMIT ?= $(shell git rev-parse HEAD) 27COMMIT ?= $(shell git rev-parse HEAD)
27IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG} 28IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
28 29
30export
31
29# Build Deckhand Docker image for this project 32# Build Deckhand Docker image for this project
30.PHONY: images 33.PHONY: images
31images: build_deckhand 34images: build_deckhand
32 35
33# Create tgz of the chart 36# Create tgz of the chart
34.PHONY: charts 37.PHONY: charts
35charts: clean 38charts: helm-init
36 $(HELM) dep up charts/deckhand 39 $(HELM) dep up charts/deckhand
37 $(HELM) package charts/deckhand 40 $(HELM) package charts/deckhand
38 41
42# Initialize local helm config
43.PHONY: helm-init
44helm-init: helm-install
45 tools/helm_tk.sh $(HELM)
46
47# Install helm binary
48.PHONY: helm-install
49helm-install:
50 tools/helm_install.sh $(HELM)
51
39# Perform linting 52# Perform linting
40.PHONY: lint 53.PHONY: lint
41lint: pep8 helm_lint 54lint: pep8 helm_lint
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 db31f2e..d666e4c 100755
--- a/tools/helm_tk.sh
+++ b/tools/helm_tk.sh
@@ -16,6 +16,15 @@
16# Script to setup helm-toolkit and helm dep up the deckhand chart 16# Script to setup helm-toolkit and helm dep up the deckhand chart
17# 17#
18HELM=$1 18HELM=$1
19HTK_REPO=${HTK_REPO:-"https://github.com/openstack/openstack-helm-infra"}
20HTK_PATH=${HTK_PATH:-""}
21HTK_STABLE_COMMIT=${HTK_COMMIT:-"2fce7e821201a5f578331370703e164d5a932fcc"}
22BUILD_DIR=${BUILD_DIR:-$(mktemp -d)}
23
24if [[ ! -z $(echo $http_proxy) ]]
25then
26 export no_proxy=$no_proxy,127.0.0.1
27fi
19 28
20set -x 29set -x
21 30
@@ -23,7 +32,7 @@ function helm_serve {
23 if [[ -d "$HOME/.helm" ]]; then 32 if [[ -d "$HOME/.helm" ]]; then
24 echo ".helm directory found" 33 echo ".helm directory found"
25 else 34 else
26 ${HELM} init --client-only 35 ${HELM} init --client-only --skip-refresh
27 fi 36 fi
28 if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then 37 if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then
29 ${HELM} serve & > /dev/null 38 ${HELM} serve & > /dev/null
@@ -42,11 +51,19 @@ function helm_serve {
42 ${HELM} repo add local http://localhost:8879/charts 51 ${HELM} repo add local http://localhost:8879/charts
43} 52}
44 53
45mkdir -p build 54mkdir -p "$BUILD_DIR"
46cd build 55pushd "$BUILD_DIR"
47git clone --depth 1 https://git.openstack.org/openstack/openstack-helm-infra.git || true 56git clone $HTK_REPO || true
48cd openstack-helm-infra 57pushd openstack-helm-infra/$HTK_PATH
49git pull 58git reset --hard "${HTK_STABLE_COMMIT}"
59
50helm_serve 60helm_serve
61# OSH Makefile is bugged, so ensure helm is in the path
62if [[ ${HELM} != "helm" ]]
63then
64 export PATH=${PATH}:$(dirname ${HELM})
65fi
66
51make helm-toolkit 67make helm-toolkit
52${HELM} dep up ../../charts/deckhand 68popd && popd
69${HELM} dep up charts/deckhand