Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve failed exports logic #789

Merged
merged 2 commits into from
Sep 22, 2021

Conversation

keith
Copy link
Member

@keith keith commented Sep 21, 2021

If something is misconfigured in your setup, these commands can fail.
Example:

xcodebuild: error: SDK "iphonesimulator14.4" cannot be located.
xcodebuild: error: SDK "iphonesimulator14.4" cannot be located.
xcrun: error: unable to lookup item 'Path' in SDK 'iphonesimulator14.4

In this case, because the execution of the command, and the export,
were in the statement, bash ignores the exit code. This breaks that up.

We could also break this up with:

foo=$(...)
export foo

But that doesn't work in the postprocessing currently done with exports.

If something is misconfigured in your setup, these commands can fail.
Example:

```
xcodebuild: error: SDK "iphonesimulator14.4" cannot be located.
xcodebuild: error: SDK "iphonesimulator14.4" cannot be located.
xcrun: error: unable to lookup item 'Path' in SDK 'iphonesimulator14.4
```

In this case, because the execution of the command, and the `export`,
were in the statement, bash ignores the exit code. This breaks that up.

We could also break this up with:

```
foo=$(...)
export foo
```

But that doesn't work in the postprocessing currently done with exports.
@UebelAndre
Copy link
Collaborator

Nice! Is there some kind of regression test we can add? Or is this dependent upon a particular host (mis)configuration?

@keith
Copy link
Member Author

keith commented Sep 21, 2021

It's dependent on host misconfiguration realistically

@keith
Copy link
Member Author

keith commented Sep 21, 2021

Theoretically we could spin up a specific test job and pass some invalid value and make sure it fails, but probably too much overhead

@UebelAndre
Copy link
Collaborator

If you could add a comment about why this pattern is important, I'd be happy to get this in 😀

@keith
Copy link
Member Author

keith commented Sep 22, 2021

Updated with a link to the shellcheck details

Copy link
Collaborator

@UebelAndre UebelAndre left a comment

Choose a reason for hiding this comment

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

Awesome! Thank you!

@UebelAndre UebelAndre enabled auto-merge (squash) September 22, 2021 00:20
@UebelAndre UebelAndre merged commit 6c0c2af into bazel-contrib:main Sep 22, 2021
@keith keith deleted the ks/improve-failed-exports-logic branch September 22, 2021 00:36
@keith
Copy link
Member Author

keith commented Sep 22, 2021

thanks!

htuch pushed a commit to envoyproxy/envoy that referenced this pull request Sep 23, 2021
This update is required for this commit
bazel-contrib/rules_foreign_cc@c41020e
in order to support Apple Silicon. Since our last update there have been
some breaking API changes. I followed these instructions to migrate:

https://github.com/bazelbuild/rules_foreign_cc/releases/tag/0.3.0
https://github.com/bazelbuild/rules_foreign_cc/releases/tag/0.4.0

This was reverted once because of a regression fixed by bazel-contrib/rules_foreign_cc@da8952e

It was reverted again because we saw a failure on envoy-mobile, but that issue turned out to be a configuration issue there, not the fault of this change. bazel-contrib/rules_foreign_cc#789 provides a better error for that case in the future, but isn't required

This reverts commit 7760bc0.

Signed-off-by: Keith Smiley <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants