-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[meta] updated pre-commit versioning and taskfile
- Loading branch information
Showing
4 changed files
with
121 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
version: '3' | ||
vars: | ||
CYAN: tput setaf 6 | ||
RED: tput setaf 1 | ||
YELLOW: tput setaf 3 | ||
GREEN: tput setaf 2 | ||
BLUE: tput setaf 1 | ||
PURPLE: tput setaf 5 | ||
BG_B: tput setab 0 | ||
BOLD: tput bold | ||
RESET: tput sgr0 | ||
CLEAR: tput reset | ||
PATH_ERROR: is not installed or correctly configured in PATH. | ||
env: | ||
VERSION: "1.3.1" | ||
|
||
silent: true | ||
|
||
# Thanks https://avasdream.engineer/kubernetes-longhorn-stuck-terminating | ||
|
||
tasks: | ||
install: | ||
preconditions: | ||
- sh: "which pre-commit" | ||
msg: "pre-commit {{.PATH_ERROR}}" | ||
cmds: | ||
- pre-commit install | ||
- pre-commit install-hooks | ||
ignore_error: true | ||
|
||
test: | ||
preconditions: | ||
- sh: "which pre-commit" | ||
msg: "pre-commit {{.PATH_ERROR}}" | ||
cmds: | ||
- pre-commit run --all-files | ||
|
||
update: | ||
preconditions: | ||
- sh: "which pre-commit" | ||
msg: "pre-commit {{.PATH_ERROR}}" | ||
cmds: | ||
- pre-commit autoupdate | ||
|
||
default: | ||
preconditions: | ||
- sh: "which pre-commit" | ||
msg: "pre-commit {{.PATH_ERROR}}" | ||
cmds: | ||
- task: install | ||
- task: update | ||
- task: test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
version: '3' | ||
|
||
silent: true | ||
|
||
vars: | ||
CONTROLLER_IPV4: https://192.168.1.2:6443 | ||
BACKUP_TIME: | ||
sh: echo $(date +%s) | ||
|
||
tasks: | ||
gen:init: | ||
dir: config/talos | ||
cmds: | ||
- task: gen:backup | ||
- task: gen:clean | ||
- talosctl gen config homelab {{.CONTROLLER_IPV4}} | ||
ignore_error: true | ||
|
||
gen:clean: | ||
dir: config/talos | ||
cmds: | ||
- rm controlplane.yaml worker.yaml talosconfig | ||
|
||
gen:init:patch: | ||
dir: config/talos | ||
cmds: | ||
- task: gen:backup | ||
- task: gen:clean | ||
- | | ||
talosctl gen config homelab {{.CONTROLLER_IPV4}} \ | ||
--config-patch @patch.yaml \ | ||
--config-patch-control-plane @controller-patch.yaml \ | ||
--config-patch-worker @worker-patch.yaml | ||
ignore_error: true | ||
|
||
gen:patch: | ||
dir: config/talos | ||
cmds: | ||
- task: gen:backup | ||
- talosctl machineconfig patch worker.yaml --patch @worker-patch.yaml -o worker.yaml | ||
- talosctl machineconfig patch controlplane.yaml --patch @controller-patch.yaml -o controlplane.yaml | ||
ignore_error: true | ||
|
||
gen:backup: | ||
dir: config/talos | ||
cmds: | ||
- | | ||
for file in controller.yaml controlplane.yaml worker.yaml talosconfig; do | ||
if [ -f "$file" ]; then | ||
filename=$(basename -- "$file") | ||
extension="${filename##*.}" | ||
filename="${filename%.*}" | ||
cp "$file" "backup/${filename}_{{.BACKUP_TIME}}.${extension}" | ||
fi | ||
done |