feat: add repo taskfile for cleaning up repo

Signed-off-by: Devin Buhl <devin@buhl.casa>
This commit is contained in:
Devin Buhl committed 2024-01-12 08:55:27 -05:00
1 parent 00ec522096
commit 1ff3c252ca
5 files changed
+47 -8

No files matched your search

+2 -2
View File
@@ -36,7 +36,7 @@
},
"kustomize": {
"fileMatch": [
"(^|/)kustomization\\.ya?ml(\\.j2)?$"
"(^|/)kustomization\\.ya?ml(\\.j2)?(\\.j2)?$"
]
},
// commit message topics
@@ -228,7 +228,7 @@
"(^|/)addons/.+\\.ya?ml(\\.j2)?(\\.j2)?$",
"(^|/)ansible/.+\\.ya?ml(\\.j2)?(\\.j2)?$",
"(^|/)kubernetes/.+\\.ya?ml(\\.j2)?(\\.j2)?$",
"(^|/)k0s/.+\\.ya?ml(\\.j2)?(\\.j2)?$"
"(^|/)k0s-config.ya?ml(\\.j2)?(\\.j2)?$"
],
"matchStrings": [
// Example: `k3s_release_version: "v1.27.3+k3s1"`
+2
View File
@@ -8,6 +8,8 @@ kubeconfig
*.agekey
*.pub
*.key
# Private
.private
# Ansible
.venv*
# Taskfile
+6 -6
View File
@@ -29,12 +29,6 @@ tasks:
- { msg: "Flux already appears installed", sh: "kubectl get namespace flux-system &>/dev/null && exit 1 || exit 0" }
- { msg: "Age private key not found", sh: "test -f {{.ROOT_DIR}}/age.key" }
github-deploy-key:
cmds:
- sops --decrypt {{.KUBERNETES_DIR}}/bootstrap/github-deploy-key.sops.yaml | kubectl apply -f -
preconditions:
- { msg: "Flux is not installed", sh: "kubectl get namespace flux-system &>/dev/null && exit 0 || exit 1" }
apply:
desc: Apply a Flux Kustomization resource for a cluster
summary: |
@@ -61,3 +55,9 @@ tasks:
reconcile:
desc: Force update Flux to pull in changes from your Git repository
cmd: flux reconcile --namespace flux-system kustomization cluster --with-source
github-deploy-key:
cmds:
- sops --decrypt {{.KUBERNETES_DIR}}/bootstrap/github-deploy-key.sops.yaml | kubectl apply --server-side --filename -
preconditions:
- { msg: "Flux is not installed", sh: "kubectl get namespace flux-system &>/dev/null && exit 0 || exit 1" }
+36
View File
@@ -0,0 +1,36 @@
---
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
tasks:
clean:
desc: Clean files and directories no longer needed after cluster bootstrap
cmds:
# Move bootstrap directory to gitignored directory
- mkdir -p {{.ROOT}}/.private
- mv {{.ROOT}}/bootstrap {{.ROOT}}/.private
# Update renovate.json5
- sed -i '' 's/(..\.j2)\?(..\.j2)\?//g' {{.ROOT}}/.github/renovate.json5
- sed -i '' 's/addons/d' {{.ROOT}}/.github/renovate.json5
preconditions:
- { msg: "bootstrap dir not found", sh: "test -d {{.ROOT}}/bootstrap" }
- { msg: "renovate.json5 not found", sh: "test -f {{.ROOT_DIR}}/.github/renovate.json5" }
reset:
desc: Remove templated configuration files
prompt: Remove templated configuration files... continue?
cmds:
- rm -rf {{.ROOT}}/.sops.yaml
- rm -rf {{.ROOT}}/k0s-config.yaml
- rm -rf {{.ROOT}}/ansible
- rm -rf {{.ROOT}}/kubernetes
reset-repo:
desc: Set repo back to HEAD
prompt: Set repo back to HEAD... continue?
cmds:
- task: reset
- git reset --hard HEAD
- git clean -f -d
- git pull
+1
View File
@@ -18,6 +18,7 @@ includes:
taskfile: .taskfiles/KubernetesTasks.yaml
flux: .taskfiles/FluxTasks.yaml
k0s: .taskfiles/K0sTasks.yaml
repo: .taskfiles/RepoTasks.yaml
tasks: