tools/app-gen-tool/bin/fetch_chart_info.sh
Mingyuan Qi d722dc6a9b Add user application generation tool
This commit adds the user app gen tool for customer application
development. This tool completely decouples app development
from stx build, which means the app developers no longer need
to fetch stx code/build tool nor to build app by stx build system.

Features:

1. One command to package chart, generate manifest, checksum and
   package app.
2. Supports local dir, git repo and tarball as chart source.
3. The app manifest abstracts a few important fields from armada
   schema for user to lower the learning curve of armada.
4. Static value overrides allowed in app manifest

Story: 2006974
Task: 37704

Change-Id: I25a85e9fd7bdd0130041499eb9b1fc1350a63756
Signed-off-by: Mingyuan Qi <mingyuan.qi@intel.com>
2019-12-09 02:53:49 +00:00

40 lines
810 B
Bash
Executable File

#!/bin/bash
OP=$1
CHARTDIR=$2
if [ -z "$OP"]; then
exit 1
fi
if [ -z "$CHARTDIR"]; then
exit 1
fi
if [ $OP == "waitlabel" ]; then
KIND=("Deployment" "StatefulSet" "DaemonSet")
if [ ! -d $CHARTDIR/templates ]; then
exit 1
fi
cd $CHARTDIR/templates
for target in ${KIND[@]}; do
output=$(grep $target . -rn | awk -F ':' '{print$1}' \
| xargs awk -F ':' '/{{ .Release.Name }}/{print$1; exit}')
if [ "x$output" != "x" ]; then
echo $output
exit 0
fi
done
elif [ $OP == "chartname" ]; then
if [ ! -f $CHARTDIR/Chart.yaml ]; then
exit 1
fi
cd $CHARTDIR
output=$(awk '/name:/{print$2;exit}' Chart.yaml)
if [ "x$output" != "x" ]; then
echo $output
exit 0
fi
fi
exit 1