script fix
This commit is contained in:
1 parent
c5c59320c1
commit
7ee1c4e2d8
1 file changed
+6
-12
@@ -108,24 +108,18 @@ sudo install -o root -g nixbld -m 0440 \
|
|||||||
# Requires mikefarah/yq v4 and simple comma-separated age fields.
|
# Requires mikefarah/yq v4 and simple comma-separated age fields.
|
||||||
export AGE_PUBLIC_KEY
|
export AGE_PUBLIC_KEY
|
||||||
|
|
||||||
# Confirm at least one creation rule contains an age key group.
|
# Confirm at least one age key group exists.
|
||||||
if ! yq -e '
|
if ! yq -e '
|
||||||
[.creation_rules[]
|
[.creation_rules[].key_groups[] | select(.age != null)] | length > 0
|
||||||
| select(.key_groups != null)
|
|
||||||
| .key_groups[]
|
|
||||||
| select(.age != null)]
|
|
||||||
| length > 0
|
|
||||||
' "$SOPS_CONFIG" >/dev/null; then
|
' "$SOPS_CONFIG" >/dev/null; then
|
||||||
echo "No creation_rules with key_groups.age found in .sops.yaml" >&2
|
echo "No creation_rules with key_groups.age found in .sops.yaml" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add the temporary public key to every age key group.
|
# Add the temporary public key to each age recipient list.
|
||||||
yq -i '
|
yq -y -i '
|
||||||
(.creation_rules[].key_groups[] | select(.age != null).age) +=
|
(.creation_rules[].key_groups[] | select(.age != null).age) |=
|
||||||
[strenv(AGE_PUBLIC_KEY)]
|
(. + [env.AGE_PUBLIC_KEY] | unique)
|
||||||
|
|
|
||||||
(.creation_rules[].key_groups[] | select(.age != null).age) |= unique
|
|
||||||
' "$SOPS_CONFIG"
|
' "$SOPS_CONFIG"
|
||||||
|
|
||||||
echo "Updating SOPS recipients for secrets in $VM_FOLDER..."
|
echo "Updating SOPS recipients for secrets in $VM_FOLDER..."
|
||||||
|
|||||||
Reference in new issue
Block a user