Files
auricom-home-cluster/.taskfiles/sops/Taskfile.yaml
2025-01-12 02:00:10 +01:00

20 lines
624 B
YAML

---
# yaml-language-server: $schema=https://taskfile.dev/schema.json
version: "3"
tasks:
fix-mac:
desc: Fix Sops MAC mismatch
cmd: |
find ./kubernetes -name '*.sops.yaml' | while read -r file;
do
sops -d "${file}" >/dev/null 2>&1 && rc=$? || rc=$?
# In case of MAC mismatch, then MAC is regenerated
# See https://github.com/mozilla/sops/blob/v3.6.1/cmd/sops/codes/codes.go#L19
if [ $rc -eq 51 ] ; then
echo "Regenerating sops MAC for: ${file}"
EDITOR="vim -es +'norm Go' +':wq'" sops --ignore-mac "${file}"
fi
done