Skip to content

presubmit: shell_commands should exit if any command fails#127

Merged
ola-rozenfeld merged 2 commits intobazelbuild:masterfrom
mostynb:bazelci_shell_commands_set_e
Mar 16, 2020
Merged

presubmit: shell_commands should exit if any command fails#127
ola-rozenfeld merged 2 commits intobazelbuild:masterfrom
mostynb:bazelci_shell_commands_set_e

Conversation

@mostynb
Copy link
Copy Markdown
Contributor

@mostynb mostynb commented Mar 5, 2020

This may not be needed if/when this bazelci PR lands:
bazelbuild/continuous-integration#957

@googlebot googlebot added the cla: yes The author signed a CLA label Mar 5, 2020
Copy link
Copy Markdown
Contributor

@ola-rozenfeld ola-rozenfeld left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this is just so that it fails fast and doesn't run the build if format fails, etc? Because the lint check certainly works, I remember failing it a few times.

@mostynb
Copy link
Copy Markdown
Contributor Author

mostynb commented Mar 16, 2020

So this is just so that it fails fast and doesn't run the build if format fails, etc? Because the lint check certainly works, I remember failing it a few times.

If by lint you mean "go vet", I think that can fail the build because it's the last line in the shell_commands. The problem is that bazelci joins all the shell_commands lines with a newline in between, then executes them together, and the shell only gives the exit code of the last command.

This PR in the bazel-remote repository demonstrates the issue: buchgr/bazel-remote#191

Note that the first commit should obviously fail, but it didn't: buchgr/bazel-remote@1d0a0c5
Then when I added set -e, it did fail: buchgr/bazel-remote@8955f60

@ola-rozenfeld ola-rozenfeld merged commit 4b8acdc into bazelbuild:master Mar 16, 2020
@mostynb mostynb deleted the bazelci_shell_commands_set_e branch March 16, 2020 23:13
pl4nty pushed a commit to pl4nty/remote-apis-sdks that referenced this pull request Apr 18, 2025
…d#127)

* presubmit: shell_commands should exit if any command fails

This may not be needed if this bazelci PR lands:
bazelbuild/continuous-integration#957

* presubmit: use consistent indentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes The author signed a CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants