Create Makefile target to install Helm binary
In Makefile there is no target which actually installs Helm binary. Change-Id: I74a8099d7ff9592f3a86df060a9a54e2b56f6f33 Signed-off-by: Dimitrios Markou <dm844v@att.com>
This commit is contained in:
parent
82639b443f
commit
f884d248d1
17
Makefile
17
Makefile
@ -12,11 +12,12 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
BUILD_DIR := $(shell mkdir -p build && mktemp -d -p build)
|
||||
DOCKER_REGISTRY ?= quay.io
|
||||
IMAGE_NAME ?= deckhand
|
||||
IMAGE_PREFIX ?= airshipit
|
||||
IMAGE_TAG ?= latest
|
||||
HELM ?= helm
|
||||
HELM := $(shell realpath $(BUILD_DIR))/helm
|
||||
PROXY ?= http://proxy.foo.com:8000
|
||||
NO_PROXY ?= localhost,127.0.0.1,.svc.cluster.local
|
||||
USE_PROXY ?= false
|
||||
@ -26,16 +27,28 @@ LABEL ?= org.airshipit.build=community
|
||||
COMMIT ?= $(shell git rev-parse HEAD)
|
||||
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}
|
||||
|
||||
export
|
||||
|
||||
# Build Deckhand Docker image for this project
|
||||
.PHONY: images
|
||||
images: build_deckhand
|
||||
|
||||
# Create tgz of the chart
|
||||
.PHONY: charts
|
||||
charts: clean
|
||||
charts: helm-init
|
||||
$(HELM) dep up charts/deckhand
|
||||
$(HELM) package charts/deckhand
|
||||
|
||||
# Initialize local helm config
|
||||
.PHONY: helm-init
|
||||
helm-init: helm-install
|
||||
tools/helm_tk.sh $(HELM)
|
||||
|
||||
# Install helm binary
|
||||
.PHONY: helm-install
|
||||
helm-install:
|
||||
tools/helm_install.sh $(HELM)
|
||||
|
||||
# Perform linting
|
||||
.PHONY: lint
|
||||
lint: pep8 helm_lint
|
||||
|
44
tools/helm_install.sh
Executable file
44
tools/helm_install.sh
Executable 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
|
@ -16,6 +16,15 @@
|
||||
# Script to setup helm-toolkit and helm dep up the deckhand chart
|
||||
#
|
||||
HELM=$1
|
||||
HTK_REPO=${HTK_REPO:-"https://github.com/openstack/openstack-helm-infra"}
|
||||
HTK_PATH=${HTK_PATH:-""}
|
||||
HTK_STABLE_COMMIT=${HTK_COMMIT:-"2fce7e821201a5f578331370703e164d5a932fcc"}
|
||||
BUILD_DIR=${BUILD_DIR:-$(mktemp -d)}
|
||||
|
||||
if [[ ! -z $(echo $http_proxy) ]]
|
||||
then
|
||||
export no_proxy=$no_proxy,127.0.0.1
|
||||
fi
|
||||
|
||||
set -x
|
||||
|
||||
@ -23,7 +32,7 @@ function helm_serve {
|
||||
if [[ -d "$HOME/.helm" ]]; then
|
||||
echo ".helm directory found"
|
||||
else
|
||||
${HELM} init --client-only
|
||||
${HELM} init --client-only --skip-refresh
|
||||
fi
|
||||
if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then
|
||||
${HELM} serve & > /dev/null
|
||||
@ -42,11 +51,19 @@ function helm_serve {
|
||||
${HELM} repo add local http://localhost:8879/charts
|
||||
}
|
||||
|
||||
mkdir -p build
|
||||
cd build
|
||||
git clone --depth 1 https://git.openstack.org/openstack/openstack-helm-infra.git || true
|
||||
cd openstack-helm-infra
|
||||
git pull
|
||||
mkdir -p "$BUILD_DIR"
|
||||
pushd "$BUILD_DIR"
|
||||
git clone $HTK_REPO || true
|
||||
pushd openstack-helm-infra/$HTK_PATH
|
||||
git reset --hard "${HTK_STABLE_COMMIT}"
|
||||
|
||||
helm_serve
|
||||
# OSH Makefile is bugged, so ensure helm is in the path
|
||||
if [[ ${HELM} != "helm" ]]
|
||||
then
|
||||
export PATH=${PATH}:$(dirname ${HELM})
|
||||
fi
|
||||
|
||||
make helm-toolkit
|
||||
${HELM} dep up ../../charts/deckhand
|
||||
popd && popd
|
||||
${HELM} dep up charts/deckhand
|
||||
|
Loading…
Reference in New Issue
Block a user