Skip to content

Instantly share code, notes, and snippets.

@gyant
Last active April 16, 2023 03:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gyant/8952f5e2494f26d0eb398ba900d3d14e to your computer and use it in GitHub Desktop.
Save gyant/8952f5e2494f26d0eb398ba900d3d14e to your computer and use it in GitHub Desktop.
SOPS Helpers
#!/bin/bash
FILES=$(find . -ipath '*/secrets/*.yml' | grep -v .enc.yml)
for i in $FILES; do
rm $i
done
#!/bin/bash
FILES=$(find . -ipath '*/secrets/*.yml' | grep .enc.yml)
for i in $FILES; do
NEW_FILENAME=$(echo -n "$i" | sed 's/enc.yml/yml/g')
sops --decrypt $i > $NEW_FILENAME
done
#!/bin/bash
FILES=$(find . -ipath '*/secrets/*.yml' | grep -v .enc.yml)
for i in $FILES; do
NEW_FILENAME=$(echo -n "$i" | sed 's/yml/enc.yml/g')
sops --encrypt $i > $NEW_FILENAME || exit 1;
rm $i
done
**/secrets/**
!**/secrets/**.enc.yml
!**/secrets/**.enc.yaml
!**/secrets/**.enc.json
!**/secrets/**.enc.toml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment