Use helm 3 in chart build

`helm serve` is removed in helm 3 so this moves
to using local `file://` dependencies [0] instead.

[0]: https://helm.sh/docs/chart_best_practices/dependencies/#repository-urls

Signed-off-by: Sean Eagan <seaneagan1@gmail.com>
Change-Id: Ia45c57e0cccac477f6ff59a254d03d6fcec14bef
This commit is contained in:
Sean Eagan 2021-07-26 16:13:54 -05:00
parent ccadbc05b8
commit 9d696ca0a4
15 changed files with 24 additions and 75 deletions

View File

@ -10,7 +10,6 @@ charts/*/requirements.lock
.eggs
.fiotest
.git
.helm-pid
.tox
AUTHORS
ChangeLog

2
.gitignore vendored
View File

@ -5,11 +5,11 @@
/charts/*.tgz
/charts/*/charts
/charts/*/requirements.lock
/charts/deps/*/
# Build & test artifacts
/.cache
/.eggs
/.helm-pid
/.pytest_cache
/.tox
/build

View File

@ -27,14 +27,10 @@ LABEL ?= org.airshipit.build=community
COMMIT ?= $(shell git rev-parse HEAD)
DISTRO ?= ubuntu_bionic
PYTHON = python3
CHARTS := $(patsubst charts/%/.,%,$(wildcard charts/*/.))
CHARTS := $(filter-out deps, $(patsubst charts/%/.,%,$(wildcard charts/*/.)))
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}-${DISTRO}
BASE_IMAGE ?=
HELM_PIDFILE ?= $(abspath ./.helm-pid)
CHARTS := $(patsubst charts/%/.,%,$(wildcard charts/*/.))
all: charts lint
tests: external-deps gate-lint
@ -63,9 +59,9 @@ charts: $(CHARTS)
helm-init: $(addprefix helm-init-,$(CHARTS))
helm-init-%: helm-serve
helm-init-%: helm-toolkit
@echo Initializing chart $*
cd charts;if [ -s $*/requirements.yaml ]; then echo "Initializing $*";$(HELM) dep up $*; fi
cd charts;if [ -s $*/requirements.yaml ]; then echo "Initializing $*";$(HELM) dep up --skip-refresh $*; fi
lint: helm-lint gate-lint
@ -127,8 +123,8 @@ ifeq ($(PUSH_IMAGE), true)
endif
helm-serve: helm-install
./tools/helm_tk.sh $(HELM) $(HELM_PIDFILE)
helm-toolkit: helm-install
./tools/helm_tk.sh $(HELM)
clean:
rm -rf doc/build
@ -143,5 +139,5 @@ helm-install:
.PHONY: $(CHARTS) all build_promenade charts check-docker clean docs \
dry-run dry-run-% external-deps gate-lint gate-lint-deps helm-init \
helm-init-% helm-install helm-lint helm-lint-% helm-serve images \
helm-init-% helm-install helm-lint helm-lint-% helm-toolkit images \
lint tests tests-pep8 tests-security tests-unit

View File

@ -14,5 +14,5 @@
dependencies:
- name: helm-toolkit
repository: http://localhost:8879/charts
repository: file://../deps/helm-toolkit
version: ">= 0.1.0"

View File

@ -14,5 +14,5 @@
dependencies:
- name: helm-toolkit
repository: http://localhost:8879/charts
repository: file://../deps/helm-toolkit
version: ">= 0.1.0"

View File

@ -14,5 +14,5 @@
dependencies:
- name: helm-toolkit
repository: http://localhost:8879/charts
repository: file://../deps/helm-toolkit
version: ">= 0.1.0"

View File

@ -1,4 +1,4 @@
dependencies:
- name: helm-toolkit
repository: http://localhost:8879/charts
repository: file://../deps/helm-toolkit
version: ">= 0.1.0"

0
charts/deps/.gitkeep Normal file
View File

View File

@ -14,5 +14,5 @@
dependencies:
- name: helm-toolkit
repository: http://localhost:8879/charts
repository: file://../deps/helm-toolkit
version: ">= 0.1.0"

View File

@ -1,4 +1,4 @@
dependencies:
- name: helm-toolkit
repository: http://localhost:8879/charts
repository: file://../deps/helm-toolkit
version: ">= 0.1.0"

View File

@ -1,4 +1,4 @@
dependencies:
- name: helm-toolkit
repository: http://localhost:8879/charts
repository: file://../deps/helm-toolkit
version: ">= 0.1.0"

View File

@ -1,4 +1,4 @@
dependencies:
- name: helm-toolkit
repository: http://localhost:8879/charts
repository: file://../deps/helm-toolkit
version: ">= 0.1.0"

View File

@ -1,4 +1,4 @@
dependencies:
- name: helm-toolkit
repository: http://localhost:8879/charts
repository: file://../deps/helm-toolkit
version: ">= 0.1.0"

View File

@ -17,7 +17,7 @@
set -x
HELM=$1
HELM_ARTIFACT_URL=${HELM_ARTIFACT_URL:-"https://get.helm.sh/helm-v2.17.0-linux-amd64.tar.gz"}
HELM_ARTIFACT_URL=${HELM_ARTIFACT_URL:-"https://get.helm.sh/helm-v3.6.3-linux-amd64.tar.gz"}
function install_helm_binary {

View File

@ -16,62 +16,16 @@
set -eux
HELM=${1}
HELM_PIDFILE=${2}
SERVE_DIR=$(mktemp -d)
HTK_REPO=${HTK_REPO:-"https://opendev.org/openstack/openstack-helm-infra.git"}
HTK_STABLE_COMMIT=${HTK_COMMIT:-"4a490b894ce2a3c547075a5559de58fd07124401"}
${HELM} init --client-only --skip-refresh
if [[ -s ${HELM_PIDFILE} ]]; then
HELM_PID=$(cat "${HELM_PIDFILE}")
if ps "${HELM_PID}"; then
kill "${HELM_PID}"
sleep 0.5
if ps "${HELM_PID}"; then
echo Failed to terminate Helm, PID = "${HELM_PID}"
exit 1
fi
fi
fi
${HELM} serve & > /dev/null
HELM_PID=${!}
echo Started Helm, PID = "${HELM_PID}"
echo "${HELM_PID}" > "${HELM_PIDFILE}"
set +x
if [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; then
while [[ -z $(curl -s 127.0.0.1:8879 | grep 'Helm Repository') ]]; do
sleep 1
echo "Waiting for Helm Repository"
done
else
echo "Helm serve already running"
fi
set -x
if ${HELM} repo list | grep -q "^stable" ; then
${HELM} repo remove stable
fi
${HELM} repo add local http://localhost:8879/charts
#OSH Makefile is bugged, so ensure helm is in the path
if [[ ${HELM} != "helm" ]]
then
export PATH=${PATH}:$(dirname ${HELM})
fi
TMP_DIR=$(mktemp -d)
{
cd "${SERVE_DIR}"
git clone https://git.openstack.org/openstack/openstack-helm-infra.git || true
cd openstack-helm-infra
git reset --hard "${HTK_STABLE_COMMIT}"
make helm-toolkit
HTK_REPO_DIR=$TMP_DIR/htk
git clone "$HTK_REPO" "$HTK_REPO_DIR"
(cd "$HTK_REPO_DIR" && git reset --hard "${HTK_STABLE_COMMIT}")
cp -r "${HTK_REPO_DIR}/helm-toolkit" charts/deps/
}
rm -rf "${SERVE_DIR}"
rm -rf "${TMP_DIR}"