summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-11-04 11:52:48 +0100
committerBartek Grzybowski <b.grzybowski@partner.samsung.com>2020-11-04 11:52:48 +0100
commit9ab0e2e33a5f2fd59ce175511aef8437922e1634 (patch)
tree726b3faeb191603ce180125d884628544dea3609
parent1de32628e9e45475ce5132b9d58313c7a735db28 (diff)
Setup temporary helm repository
A temporary helm repository will be created for the process of preparing data list and removed afterwards. This allows setting a separate working helm repo not affecting system wide configuration. Change-Id: I775e28b7c5f0e9b5259588032346ff392f1b1803 Issue-ID: OOM-2623 Signed-off-by: Bartek Grzybowski <b.grzybowski@partner.samsung.com>
-rwxr-xr-xbuild/creating_data/docker-images-collector.sh36
1 files changed, 23 insertions, 13 deletions
diff --git a/build/creating_data/docker-images-collector.sh b/build/creating_data/docker-images-collector.sh
index a6b3c470..253246d5 100755
--- a/build/creating_data/docker-images-collector.sh
+++ b/build/creating_data/docker-images-collector.sh
@@ -65,6 +65,14 @@ create_list() {
-e 's/\x27\|,//g; s/^.*\(image\|tag_version\):\ //' | tr -d '\r'
}
+# Kill helm if already running
+kill_helm() {
+ for pid in $(pgrep -f "helm serve --address ${HELM_REPO}");
+ do
+ kill $pid
+ done
+}
+
# Configuration
if [ "${1}" == "-h" ] || [ "${1}" == "--help" ] || [ $# -lt 1 ]; then
usage
@@ -73,7 +81,8 @@ fi
PROJECT_DIR="${1}"
LIST="${2}"
LISTS_DIR="$(readlink -f $(dirname ${0}))/../data_lists"
-HELM_REPO="local http://127.0.0.1:8879"
+HELM_REPO="127.0.0.1:8879"
+HELM_REPO_PATH="dist/packages" # based on PACKAGE_DIR defined in oom/kubernetes/Makefile
PROJECT="$(basename ${1})"
if [ ! -f "${PROJECT_DIR}/../Makefile" ]; then
@@ -95,18 +104,13 @@ if [ -e "${LIST}" ]; then
fi
# Setup helm
-if ps -eaf | grep -v "grep" | grep "helm" > /dev/null; then
- echo "helm is already running"
-else
- helm init -c > /dev/null
- helm serve &
- helm repo remove stable 2>/dev/null || true
-fi
-
-# Create helm repository
-if ! helm repo list 2>&1 | awk '{ print $1, $2 }' | grep -q "$HELM_REPO" > /dev/null; then
- helm repo add $HELM_REPO
-fi
+HELM_HOME=$(mktemp -p /tmp -d .helm.XXXXXXXX)
+export HELM_HOME
+kill_helm # make sure it's not already running
+mkdir -p "${PROJECT_DIR}/../${HELM_REPO_PATH}"
+helm init -c --local-repo-url "http://${HELM_REPO}"
+helm serve --address ${HELM_REPO} --repo-path "${PROJECT_DIR}/../${HELM_REPO_PATH}" &
+helm repo remove stable 2>/dev/null || true
# Make all
pushd "${PROJECT_DIR}/.."
@@ -132,4 +136,10 @@ sed -i "1i# generated from ${COMMENT}" "${LIST}"
echo -e ${MSG}
echo -e 'The list has been created:\n '"${LIST}"
+
+# Remove temporary helm directory
+rm -rf ${HELM_HOME}
+# Kill helm
+kill_helm
+
exit 0