Skip to content

Commit 39d46f2

Browse files
test(e2e): stage yq output to a file instead of piping
The prior commit added `set -o pipefail` to catch yq failures in the prepull pipeline. CI failed at runtime: hack/cozytest.sh has a `#!/bin/sh` shebang, /bin/sh is dash on Ubuntu CI, and dash rejects `set -o pipefail` ("Illegal option"). Drop the pipe entirely. Each step is now its own command with stdin/ stdout redirection — set -e catches failures at the helm-template, yq, or prepull stage without needing pipefail and without `var=$(...)` captures that would balloon the `set -x` trace with rendered YAML. Verified under dash in Ubuntu 24.04 by running cozytest.sh against the test. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 5ddcb0d commit 39d46f2

1 file changed

Lines changed: 18 additions & 11 deletions

File tree

‎hack/e2e-install-cozystack.bats‎

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,26 @@
1818
# actually pulls (skips configmap fields and CRD examples that happen to
1919
# contain an `image:` key). Add a chart here when a new peer-sensitive
2020
# workload is found.
21-
# Stream each render through a brace group instead of `var=$(helm ...)`:
22-
# `set -x` would expand captured output into the trace and balloon CI
23-
# logs, but rendered YAML flowing through a pipe stays out of stderr.
24-
# `pipefail` makes a helm-template or yq failure trip `set -e` instead
25-
# of being masked by the downstream prepull exit code.
26-
set -o pipefail
27-
{
28-
helm template packages/system/kubeovn
29-
helm template packages/system/linstor
30-
} | yq -N '
21+
# Stage each render AND the yq filter through tmp files instead of
22+
# piping. Two constraints stack here: `set -x` would expand any
23+
# `var=$(helm ...)` capture into the trace and balloon CI logs, and
24+
# `set -o pipefail` is unavailable because hack/cozytest.sh runs under
25+
# /bin/sh which is dash on Ubuntu CI. Redirection keeps each step as a
26+
# standalone command — set -e catches a failure at any stage (helm
27+
# render, yq filter, prepull) without needing pipefail and without
28+
# leaking rendered YAML into the trace.
29+
local kubeovn_yaml linstor_yaml images_list
30+
kubeovn_yaml=$(mktemp)
31+
linstor_yaml=$(mktemp)
32+
images_list=$(mktemp)
33+
helm template packages/system/kubeovn > "$kubeovn_yaml"
34+
helm template packages/system/linstor > "$linstor_yaml"
35+
yq -N '
3136
(..|select(has("containers"))|.containers[]|.image),
3237
(..|select(has("initContainers"))|.initContainers[]|.image)
33-
' | hack/e2e-prepull-images.sh
38+
' "$kubeovn_yaml" "$linstor_yaml" > "$images_list"
39+
hack/e2e-prepull-images.sh < "$images_list"
40+
rm -f "$kubeovn_yaml" "$linstor_yaml" "$images_list"
3441
}
3542

3643
@test "Install Cozystack" {

0 commit comments

Comments
 (0)