Skip to content

Commit bde16ec

Browse files
committed
Added to README for pipefail errors
1 parent df5b687 commit bde16ec

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

Diff for: docs/howitworks.md

+20
Original file line numberDiff line numberDiff line change
@@ -337,3 +337,23 @@ spec:
337337
annotations:
338338
checksum/secret: <path:secrets/data/db#certs | sha256sum>
339339
```
340+
341+
### Error Handling
342+
343+
#### Detecting errors in chained commands
344+
345+
By default argocd-vault-plugin will read valid kubernetes YAMLs and replace variables with values from Vault.
346+
If a previous command failed and outputs nothing to stdout and AVP reads the input from stdin with
347+
the `-` argument, AVP will forward an empty YAML output downstream. To catch and prevent accientental errors
348+
in chained commands, please use the `-o pipefail` bash option like so:
349+
350+
```bash
351+
$ sh -c '((>&2 echo "some error" && exit 1) | argocd-vault-plugin generate - | kubectl diff -f -); echo $?;'
352+
some error
353+
0
354+
355+
$ set -o pipefail
356+
$ sh -c '((>&2 echo "some error" && exit 1) | argocd-vault-plugin generate - | kubectl diff -f -); echo $?;'
357+
some error
358+
1
359+
```

0 commit comments

Comments
 (0)