Fix 'xargs: command line too long' in SOPS encryption task (#1594)

Co-authored-by: Devin Buhl <onedr0p@users.noreply.github.com>
This commit is contained in:
Philipp RoschandDevin Buhl authored and GitHub committed 2024-10-07 18:19:43 -04:00
1 parent 8c29e80587
commit c66400741e
1 file changed
+7 -13
+7 -13
View File
@@ -12,19 +12,13 @@ tasks:
encrypt: encrypt:
desc: Encrypt all Kubernetes SOPS secrets desc: Encrypt all Kubernetes SOPS secrets
cmds: cmds:
- for: { var: file } - cmd: |
task: .encrypt-file find "{{.KUBERNETES_DIR}}" -type f -name "*.sops.*" | while read -r file; do
vars: if sops filestatus "$file" | jq --exit-status ".encrypted == false" > /dev/null; then
file: "{{.ITEM}}" sops --encrypt --in-place "$file"
vars: echo "Encrypted $file"
file: fi
sh: find "{{.KUBERNETES_DIR}}" -type f -name "*.sops.*" | xargs -I {} sh -c 'sops filestatus {} | jq --exit-status ".encrypted == false" > /dev/null && echo {}' done
.encrypt-file:
internal: true
cmd: sops --encrypt --in-place {{.file}}
requires:
vars: ["file"]
preconditions: preconditions:
- msg: Missing Sops config file - msg: Missing Sops config file
sh: test -f {{.SOPS_CONFIG_FILE}} sh: test -f {{.SOPS_CONFIG_FILE}}