-
Notifications
You must be signed in to change notification settings - Fork 74
Expand file tree
/
Copy pathpersonalize.sh
More file actions
executable file
·22 lines (17 loc) · 990 Bytes
/
personalize.sh
File metadata and controls
executable file
·22 lines (17 loc) · 990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
echo -n "Enter GitHub username/org: "
read username
ghcr_username=$(echo "$username" | tr '[:upper:]' '[:lower:]')
find . -type f -name '*.yaml' -exec sed -E -i '' s#https://github.com/[-_a-zA-Z0-9]+#https://github.com/${username}#g {} +
find . -type f -name '*.yaml' -exec sed -E -i '' s#ghcr.io/[-_a-zA-Z0-9]+#ghcr.io/${ghcr_username}#g {} +
echo "Enter Argo CD destination name or server where applications will be deployed (e.g. in-cluster, https://kubernetes.default.svc)"
echo -n "Destination: "
read destination
if [[ $destination == https:* ]]; then
sed -i.bak -E "s@^ (# )?server:.*@ server: ${destination}@g" argocd/appset.yaml
sed -i.bak -E "s@^ (# )?name:.*@ # name: REPLACEME@g" argocd/appset.yaml
else
sed -i.bak -E "s@^ (# )?name:.*@ name: ${destination}@g" argocd/appset.yaml
sed -i.bak -E "s@^ (# )?server:.*@ # server: https://REPLACEME@g" argocd/appset.yaml
fi
rm -f argocd/appset.yaml.bak