d2a4c3d012
This updates the helm-upload to stop syncing charts to standby controller as charts are changed to store in drbd fs. Story: 2004520 Task: 28343 Depends-On: https://review.openstack.org/#/c/630763/ Change-Id: I12f17fae6124650d878ba7a560f94b7a8ed36e56 Signed-off-by: Angie Wang <angie.wang@windriver.com>
53 lines
1.2 KiB
Bash
53 lines
1.2 KiB
Bash
#!/bin/bash
|
|
|
|
#
|
|
# Copyright (c) 2018 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
# This script takes the names of packaged helm charts as arguments.
|
|
# It installs them in the on-node helm chart repository and regenerates
|
|
# the repository index.
|
|
|
|
|
|
# We want to run as the "www" user and scripts can't be setuid. The
|
|
# sudoers permissions are set up to allow wrsroot to run this script
|
|
# as the "www" user without a password.
|
|
if [ $USER != "www" ]; then
|
|
exec sudo -u www $0 $@
|
|
fi
|
|
|
|
|
|
RETVAL=0
|
|
REINDEX=0
|
|
|
|
REPO_DIR='/www/pages/helm_charts'
|
|
|
|
for FILE in "$@"; do
|
|
if [ -r $FILE ]; then
|
|
# QUESTION: should we disallow overwriting an existing file?
|
|
# The versions are embedded in the filename, so it shouldn't
|
|
# cause problems.
|
|
cp $FILE $REPO_DIR
|
|
if [ $? -ne 0 ]; then
|
|
echo Problem adding $FILE to helm chart registry.
|
|
RETVAL=1
|
|
else
|
|
REINDEX=1
|
|
fi
|
|
else
|
|
echo Cannot read file ${FILE}.
|
|
RETVAL=1
|
|
fi
|
|
done
|
|
|
|
|
|
# Now re-index the helm repository if we successfully copied in
|
|
# any new charts.
|
|
if [ $REINDEX -eq 1 ]; then
|
|
/usr/sbin/helm repo index $REPO_DIR
|
|
fi
|
|
|
|
exit $RETVAL
|