k8s-deployment/scripts/sops_check.sh
2024-10-30 13:35:58 +01:00

19 lines
454 B
Bash
Executable File

#!/usr/bin/env bash
set -e
# -- Default exit status, that should be thrown
# -- when all the secrets are encrypted
EXIT_STATUS=0
for secrets in $(find . -type 'f' -name 'secrets.*'); do
echo "Checking ${secrets}"
STATUS=$(sops filestatus $secrets)
if [[ "${STATUS}" == *"false"* ]]; then
echo "ERROR: Found an unencrypted secret: $secrets"
EXIT_STATUS=1
sops encrypt -i $secrets;
fi;
done
exit "${EXIT_STATUS}"