argocd-test/templates/bin/new-app.sh

21 lines
593 B
Bash
Raw Permalink Normal View History

2024-10-24 16:00:00 +00:00
#!/usr/bin/env bash
[ $# != 1 ] &&
echo "wrong number of args, run with --help" &&
exit 1;
APPNAME=$1
cp -r ./templates/new-svc "$APPNAME"
cp ./templates/appname-application.yaml "argocd-applications/base/$APPNAME-application.yaml"
for file in "$APPNAME"/base/* ; do
rename appname "$APPNAME" "$file"
# NEWFILE=$(echo "$file" | sed "s/appname/$APPNAME/g")
NEWFILE=${file//appname/$APPNAME}
sed -i "s/appname/$APPNAME/g" "$NEWFILE"
done
sed -i "s/appname/$APPNAME/g" "./$APPNAME/kustomization.yaml"
sed -i "s/appname/$APPNAME/g" "argocd-applications/base/$APPNAME-application.yaml"