-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yaml
More file actions
129 lines (112 loc) · 3.6 KB
/
Taskfile.yaml
File metadata and controls
129 lines (112 loc) · 3.6 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
version: 3
includes:
git:
taskfile: ./taskfiles/git.yaml
lint:
taskfile: ./taskfiles/linting.yaml
# shell:
# taskfile: ./taskfiles/dagger-shell.yaml
vars:
PROJECT_NAME:
sh: echo ${PWD##*/}
tasks:
run-terraform-shell:
cmds:
- |
MOUNT=$(echo "{{.directory | join "\n"}}" | gum choose)
dagger -c '
container |
from cgr.dev/chainguard/wolfi-base |
with-exec apk add curl git bash wget terraform kubectl |
with-mounted-directory "'"$MOUNT"'" "'"$MOUNT"'" |
with-mounted-file /root/.kube/config ../../../.kube/keycloak-cluster |
terminal
'
vars:
directory:
- keycloak
destroy-kind-cluster:
desc: Destroy a KinD cluster
cmds:
- |
CLUSTERS=$(kind get clusters)
if [ -z "$CLUSTERS" ]; then
echo "No KinD clusters found."
exit 0
fi
CLUSTER_NAME=$(echo "$CLUSTERS" | gum choose)
echo "You chose: $CLUSTER_NAME"
if gum confirm "Do you really want to delete cluster $CLUSTER_NAME?"; then
kind delete cluster --name "$CLUSTER_NAME"
echo "Cluster $CLUSTER_NAME deleted."
else
echo "Aborted."
fi
create-kind-cluster:
desc: Create a new KinD cluster
cmds:
- |
PROFILE=$(echo "{{.profiles | join "\n"}}" | gum choose)
echo "You chose: $PROFILE"
mkdir -p {{ .KUBECONFIG_PATH }} || true
CLUSTER_NAME=$(basename "$PROFILE" .yaml)
if kind get clusters | grep -q "^$CLUSTER_NAME$"; then
echo "Cluster $CLUSTER_NAME already exists."
if gum confirm "Do you want to delete and recreate it?"; then
kind delete cluster --name "$CLUSTER_NAME"
else
echo "Aborting."
exit 0
fi
fi
kind create cluster \
--name "$CLUSTER_NAME" \
--config "$PROFILE" \
--kubeconfig {{ .KUBECONFIG_PATH }}/"$CLUSTER_NAME"
vars:
profiles:
- keycloak/keycloak-cluster.yaml
- kargo/kargo-cluster.yaml
- gateway-api/gateway-api-cluster.yaml
KUBECONFIG_PATH: ~/.kube
do:
desc: Select a task to run
cmds:
- |
# Extract task names (keep internal colons, remove only trailing colon)
task_name=$(task -l | awk '/^\*/ {print $2}' | sed 's/:$//' | gum choose)
# Run the selected task
[ -n "$task_name" ] && task "$task_name"
lint-platform-engineering-showcase-repo:
desc: Lint platform-engineering-showcase repository
cmds:
- task: lint:lint-repository-files
vars:
CODE_DIR: "./"
YAML_CONFIG_PATH: ".yamllint.yml"
#EXPORT_PATH: "/tmp/whatever-showcase.txt"
default:
desc: Default task is select & do (work)
cmds:
- task do
run-pre-commit-hook:
deps:
- check
desc: "Run the pre-commit hook script to replace .example.com with .example.com"
cmds:
- |
# Find all YAML files in the repository recursively, excluding Taskfile.yaml
files=$(find . -type f \( -name "*.yaml" -o -name "*.yml" -o -name "*.yml" -o -name "*.md" \) ! -name "Taskfile.yaml")
# Loop through each file
for file in $files; do
# Skip binary files
if file "$file" | grep -q "text"; then
# Replace the string and update the file
sed -i 's/\.sva\.de/\.example\.com/g' "$file"
fi
done
# Add all modified YAML files back to staging
git add $(git ls-files --modified | grep -E '\.ya?ml$')
exit 0
silent: false