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: I2282e231591a89073e65d9db3f59e1baea707380
This commit is contained in:
Sean Eagan 2021-07-27 13:46:52 -05:00 committed by Sean Eagan
parent 68747d0815
commit f3842f9fe1
7 changed files with 23 additions and 75 deletions

12
.gitignore vendored
View File

@ -94,13 +94,11 @@ ENV/
# Rope project settings
.ropeproject
# Helm internals
*.lock
*/*.lock
*.tgz
**/*.tgz
**/_partials.tpl
**/_globals.tpl
# Chart artifacts
/charts/*.tgz
/charts/*/charts
/charts/*/requirements.lock
/charts/deps/*/
# OSX
.DS_STORE

View File

@ -27,7 +27,7 @@ PUSH_IMAGE ?= false
LABEL ?= org.airshipit.build=community
COMMIT ?= $(shell git rev-parse HEAD)
PYTHON = python3
CHARTS := $(patsubst charts/%/.,%,$(wildcard charts/*/.))
CHARTS := $(filter-out deps, $(patsubst charts/%/.,%,$(wildcard charts/*/.)))
DISTRO ?= ubuntu_bionic
IMAGE := ${DOCKER_REGISTRY}/${IMAGE_PREFIX}/${IMAGE_NAME}:${IMAGE_TAG}-${DISTRO}
UBUNTU_BASE_IMAGE ?=
@ -41,8 +41,6 @@ GIT_SHA = $(shell git rev-parse --short HEAD)
GIT_TAG = $(shell git describe --tags --abbrev=0 --exact-match 2>/dev/null)
GIT_DIRTY = $(shell test -n "`git status --porcelain`" && echo "dirty" || echo "clean")
HELM_PIDFILE ?= $(abspath ./.helm-pid)
ifdef VERSION
DOCKER_VERSION = $(VERSION)
endif
@ -167,12 +165,12 @@ 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
helm-serve: helm-install
./tools/helm_tk.sh $(HELM) $(HELM_PIDFILE)
helm-toolkit: helm-install
./tools/helm_tk.sh $(HELM)
helm-lint: $(addprefix helm-lint-,$(CHARTS))
@ -196,5 +194,5 @@ helm-install:
.PHONY: $(CHARTS) all bootstrap bootstrap-all build build_armada \
build_docs charts check-docker check-tox clean docs dry-run \
dry-run-% format helm-init helm-init-% helm-install helm-lint \
helm-lint-% helm-serve images lint protoc run_armada run_images \
helm-lint-% helm-toolkit images lint protoc run_armada run_images \
test-all test-bandit test-coverage test-pep8 tests test-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"

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

@ -17,7 +17,7 @@
set -x
HELM=$1
HELM_ARTIFACT_URL=${HELM_ARTIFACT_URL:-"https://get.helm.sh/helm-v2.16.9-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

@ -12,68 +12,20 @@
# 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.
#
# Script to setup helm-toolkit and helm dep up the armada chart
#
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:-"2d1fe882bb751c03ee741a6166c9c8a5fad8f926"}
HTK_STABLE_COMMIT=${HTK_COMMIT:-"4fe6212dad6e3f07d43122485d60ab8f38642293"}
${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}"