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

Pass --host_action_env to host options hostActionEnvironment attribute #12694

Closed
wants to merge 12 commits into from

Conversation

mai93
Copy link
Contributor

@mai93 mai93 commented Dec 14, 2020

This PR passes the value of host_action_env to hostActionEnvironment attribute of the host options in CoreOptions.getHost.

Fixes: #12403

@google-cla google-cla bot added the cla: yes label Dec 14, 2020
@@ -109,8 +109,9 @@ public boolean isHostTransition() {

@Override
public BuildOptions patch(BuildOptionsView options, EventHandler eventHandler) {
if (executionPlatform == null) {
// No execution platform is known, so don't change anything.
if (executionPlatform == null || options.get(CoreOptions.class).isExec) {
Copy link
Member

Choose a reason for hiding this comment

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

This isn't safe: it's entirely possible to need to build tools in order to build other tools. How does this lead to the error with action_env?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought that the error of conflicting actions may be caused by having two copies of the same execution transition. Adding this check fixed the --host_action_env conflicting actions issue, so I created this PR to just to make sure it does not break other tests.

Copy link
Member

Choose a reason for hiding this comment

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

If the two configurations were exactly the same, they would have the same hash. Can you check what the difference between the two is? I do not think this change is safe to submit.

You can diff two configurations by using the "bazel config" command, with the same flags, after you've run the command to cause the error. The config subcommand checks for configurations present in skyframe's cache, so anything that invalidates the cache will make this fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The only difference between the 2 configurations is com.google.devtools.build.lib.analysis.config.CoreOptions.action_env where one config includes the env var passed with host_action_env and the other doesn't.

Copy link
Member

Choose a reason for hiding this comment

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

I see that the value of hostActionEnvironment isn't being kept in CoreOptions.getHost. If you add the line, does that deal with the issue?

    // Pass host action environment variables
    host.actionEnvironment = hostActionEnvironment;
    host.hostActionEnvironment = hostActionEnvironment;

@mai93 mai93 changed the title Skip transition for input options coming from execution configuration Pass --host_action_env to host options hostActionEnvironment attribute Dec 15, 2020
@katre
Copy link
Member

katre commented Dec 15, 2020

Can you add a test for the host_action_env issue? It looks like there aren't any tests for the flag at all, putting them in https://cs.opensource.google/bazel/bazel/+/master:src/test/shell/integration/action_env_test.sh?ss=bazel&q=action_env would probably be appropriate.

-e 's/^# android_ndk_repository/android_ndk_repository/'
-e 's/^# rbe_autoconfig/rbe_autoconfig/'
-e 's/^# load("@bazel_toolchains/load("@bazel_toolchains/' WORKSPACE
- sed -i.bak
Copy link
Member

Choose a reason for hiding this comment

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

Why are there changes in the postsubmit and presubmit? We should get these reviewed by someone on who knows them better than I do.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I included these commits to fix the failing presubmit jdeps_test as mentioned in #12685

Copy link
Member

Choose a reason for hiding this comment

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

They should be submitted (and reviewed) separately, since it's not directly part of fixing this issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are already submitted, rebasing the pull request should fix this, right?

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I see. Yes, rebase onto master and that should be fine.

@google-cla
Copy link

google-cla bot commented Dec 16, 2020

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: no and removed cla: yes labels Dec 16, 2020
@google-cla google-cla bot added the cla: yes label Dec 16, 2020
Copy link
Member

@katre katre left a comment

Choose a reason for hiding this comment

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

One small nit, but otherwise this looks great. Thanks for all the work on this.


cat `bazel info ${PRODUCT_NAME}-genfiles`/pkg/successive_exec_tools_env.txt > $TEST_log
expect_log "FOO=bar"

Copy link
Member

Choose a reason for hiding this comment

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

Remove this extra blank line.

@bazel-io bazel-io closed this in e667082 Dec 17, 2020
meisterT pushed a commit that referenced this pull request Jan 12, 2021
This PR passes the value of `host_action_env` to `hostActionEnvironment` attribute of the host options in `CoreOptions.getHost`.

Fixes: #12403

Closes #12694.

PiperOrigin-RevId: 348011332
ulfjack pushed a commit to EngFlow/bazel that referenced this pull request Mar 5, 2021
This PR passes the value of `host_action_env` to `hostActionEnvironment` attribute of the host options in `CoreOptions.getHost`.

Fixes: bazelbuild#12403

Closes bazelbuild#12694.

PiperOrigin-RevId: 348011332
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Conflicting actions when using --host_action_env
2 participants