Skip to content

Commit d4a006b

Browse files
committed
ci(eql): keep cargo's status in the dry-run publish step, under errexit
The step ran eleven commands with errexit off, which the fail-fast guard refuses, and it read `status=$?` on the line after an `if`: that is the if's status, 0 when its condition failed, so a stack-encrypt version that resolved and then failed to compile would have exited 0, the silent case the step exists to catch. The status is now taken from cargo directly (`|| status=$?`) under `set -euo pipefail`, and the two exits are decided from it.
1 parent 501146a commit d4a006b

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

‎.github/workflows/test-eql.yml‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -635,12 +635,17 @@ jobs:
635635
# silent case, the one a path build can never see, and that fails.
636636
- name: Verify eql-bindings packages cleanly for crates.io
637637
run: |
638-
if out="$(cargo publish -p eql-bindings --dry-run --allow-dirty --all-features 2>&1)"; then
639-
printf '%s\n' "$out"
638+
set -euo pipefail
639+
# cargo's own status is kept in `status`: `|| status=$?` reads it
640+
# before anything else runs. (`status=$?` on the line after an `if`
641+
# reads the if's status, which is 0 when its condition failed, so a
642+
# version that resolves and then fails to compile would exit 0.)
643+
status=0
644+
out="$(cargo publish -p eql-bindings --dry-run --allow-dirty --all-features 2>&1)" || status=$?
645+
printf '%s\n' "$out"
646+
if [ "$status" -eq 0 ]; then
640647
exit 0
641648
fi
642-
status=$?
643-
printf '%s\n' "$out"
644649
if grep -qF 'failed to select a version for the requirement `stack-encrypt' <<<"$out"; then
645650
echo "::warning title=eql-bindings not verified against the registry::The stack-encrypt version eql-bindings names is not on crates.io yet, so the packaged crate could not be built against the registry here. release-plz builds it at publish time (publish_all_features in packages/eql/release-plz.toml) and refuses to publish eql-bindings until that stack-encrypt has shipped."
646651
exit 0

0 commit comments

Comments
 (0)