forked from rht-labs/ubiquitous-journey
-
Notifications
You must be signed in to change notification settings - Fork 0
/
set-namespace.sh
executable file
·32 lines (24 loc) · 1.24 KB
/
set-namespace.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
# ./set-namespace.sh $ci_cd_namespace $dev_namespace $test_namespace
if [ -z ${1} ] || [ -z ${2} ] || [ -z ${3} ]; then
echo "🤥 No namespaces specified - please set them 🤥 "
echo "./set-namespace.sh \$ci_cd_namespace \$dev_namespace \$test_namespace"
echo "For example:"
echo "./set-namespace.sh my-ci-cd my-dev my-test"
exit -1
fi
unameOut="$(uname -s)"
case "${unameOut}" in
Linux*) sedargs=-i;;
Darwin*) sedargs='-i "" -e';;
*) echo "not on Linux or Mac ?" && exit -1
esac
# 🤷♀️ bash does stupid things with $sedargs and add escape chars no matter how you set the -i '' 🤷♀️
# hence the echo commmand pipe sh to strip it out
echo sed $sedargs "s#\\\"labs-ci-cd\\\"#\\\"${1}\\\"#g" bootstrap/values-bootstrap.yaml | sh
echo sed $sedargs "s#\\\"labs-dev\\\"#\\\"${2}\\\"#g" bootstrap/values-bootstrap.yaml | sh
echo sed $sedargs "s#\\\"labs-test\\\"#\\\"${3}\\\"#g" bootstrap/values-bootstrap.yaml | sh
echo sed $sedargs "s#labs-dev#${2}#g" example-deployment/values-applications.yaml | sh
echo sed $sedargs "s#labs-ci-cd#${1}#g" ubiquitous-journey/values-tooling.yaml | sh
echo sed $sedargs "s#labs-ci-cd#${1}#g" argo-app-of-apps.yaml | sh
echo "🐙 All done - happy helming 🐙"