Skip to content

Commit 1e6e79b

Browse files
committed
Add yq function to bash-environment.md
Simplifies running yq in a container.
1 parent 5a55d06 commit 1e6e79b

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

docs/dev-environment/bash-environment.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,35 @@ alias ll='ls -lhtr --color=auto'
6565
-d "{}"
6666
}' > ~/.bashrc.d/rp-recovery-etcd
6767
```
68+
* run `yq` as a container
69+
```sh
70+
echo 'yq() {
71+
# log_level="${PODMAN_LOG_LEVEL:-warn}"
72+
#
73+
# Useful for debugging podman runtime errors
74+
log_level="${PODMAN_LOG_LEVEL:-warn}"
75+
76+
image="quay.io/konflux-ci/yq:latest"
77+
78+
# YQ_* environment variables are useful for passing variables to be parsed by yq
79+
podman run \
80+
--userns=keep-id \
81+
--env '\''YQ_*'\'' \
82+
--log-level="$log_level" \
83+
--security-opt label=disable \
84+
-i \
85+
--rm \
86+
-v=${PWD}:/workdir:rw,rshared \
87+
--workdir /workdir \
88+
"$image" \
89+
--exit-status=1 \
90+
"$@"
91+
}
92+
93+
# yq must be exported for scripts (or any subshell) to access it
94+
export -f yq
95+
' > ~/.bashrc.d/yq
96+
```
6897

6998
## Bash rc config Drop-Ins
7099

0 commit comments

Comments
 (0)