-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcosmos.sh
executable file
·66 lines (55 loc) · 1.29 KB
/
cosmos.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
create() {
# create infrastructure
pushd infrastructure
tofu apply -auto-approve
# set kube context
az aks get-credentials --resource-group cosmology --name cosmology-cluster --overwrite-existing
# return
popd
}
deploy() {
# create and push helm packages
pushd packages
for package in *; do
helm package $package
helm push *$package*.tgz "oci://registry.gitlab.com/willswire/cosmology/charts"
rm *$package*.tgz
done
popd
# decrypt secrets if they don't exist yet
if [ ! -f secrets.yaml ];
then
sops -d secrets.enc.yaml > secrets.yaml
fi
# create the zarf package
zarf package create --skip-sbom --confirm --no-progress
# deploy the zarf package
zarf package deploy zarf-package-*.tar.zst --confirm --no-progress
# remove the zarf package
rm zarf-package-*.tar.zst
}
destroy() {
# destroy infrastructure
pushd infrastructure
tofu destroy -auto-approve
# return
popd
}
cosmos() {
case "$1" in
create)
create
;;
deploy)
deploy
;;
destroy)
destroy
;;
*)
echo "Usage: cosmos {create|deploy|destroy}"
return 1
;;
esac
}