mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
Fix broken genJqSecretsReplacementSnippet for jq 1.7 (#257932)
jq 1.7 updated it's behaviour and now throws an error if the first argument is an empty string. It now needs "." to pass the input through.
This commit is contained in:
parent
31871e17ce
commit
612035c45f
1 changed files with 7 additions and 4 deletions
|
@ -177,6 +177,7 @@ rec {
|
||||||
genJqSecretsReplacementSnippet' = attr: set: output:
|
genJqSecretsReplacementSnippet' = attr: set: output:
|
||||||
let
|
let
|
||||||
secrets = recursiveGetAttrWithJqPrefix set attr;
|
secrets = recursiveGetAttrWithJqPrefix set attr;
|
||||||
|
stringOrDefault = str: def: if str == "" then def else str;
|
||||||
in ''
|
in ''
|
||||||
if [[ -h '${output}' ]]; then
|
if [[ -h '${output}' ]]; then
|
||||||
rm '${output}'
|
rm '${output}'
|
||||||
|
@ -195,10 +196,12 @@ rec {
|
||||||
(attrNames secrets))
|
(attrNames secrets))
|
||||||
+ "\n"
|
+ "\n"
|
||||||
+ "${pkgs.jq}/bin/jq >'${output}' "
|
+ "${pkgs.jq}/bin/jq >'${output}' "
|
||||||
+ lib.escapeShellArg (concatStringsSep
|
+ lib.escapeShellArg (stringOrDefault
|
||||||
" | "
|
(concatStringsSep
|
||||||
(imap1 (index: name: ''${name} = $ENV.secret${toString index}'')
|
" | "
|
||||||
(attrNames secrets)))
|
(imap1 (index: name: ''${name} = $ENV.secret${toString index}'')
|
||||||
|
(attrNames secrets)))
|
||||||
|
".")
|
||||||
+ ''
|
+ ''
|
||||||
<<'EOF'
|
<<'EOF'
|
||||||
${builtins.toJSON set}
|
${builtins.toJSON set}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue