Skip to content

Make --experimental_repo_remote_exec compatible with rbe_autoconfig - #12031

Closed
agluszak wants to merge 1 commit into
bazelbuild:masterfrom
agluszak:repo-remote-exec-rbe-autoconfig
Closed

agluszak wants to merge 1 commit into
bazelbuild:masterfrom
agluszak:repo-remote-exec-rbe-autoconfig

Conversation

@agluszak

@agluszak agluszak commented Sep 1, 2020

Copy link
Copy Markdown
Contributor

Based on #11029 by @buchgr

Closes #11029, #12030

@agluszak
agluszak requested a review from buchgr September 1, 2020 11:43
* Adds an {@code exec_properties} attribute of type {@code STRING_DICT} if the rule does not
* already have one.
*/
public static void addOrOverrideExecPropertiesAttribute(RuleClass.Builder builder)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think the previous name is fine. It's low-enough use that reading the source or doc to find out what happens when the attribute already exists is fine.

// Add the 'exec_properties' attribute last. That way it's backwards compatible with
// repository rules that already declare 'exec_properties'. In particular
// https://github.com/bazelbuild/bazel-toolchains
// TODO(buchgr): Remove this backwards compatiblity hack once the feature is marked stable.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I don't think buchgr is the right person for this anymore. Probably should be me or @juliexxia

builder.addAttribute(attr("$configure", BOOLEAN).defaultValue(configure).build());
if (thread.getSemantics().experimentalRepoRemoteExec()) {
builder.addAttribute(attr("$remotable", BOOLEAN).defaultValue(remotable).build());
BaseRuleClasses.execPropertiesAttribute(builder);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@juliexxia Is there a reason why repository rules have exec_properties? They can't be run remotely and are outside the normal action system, so it seems like it'd be unused. Might be simpler to just remove it from repo rules entirely rather than adding this conditionally.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like @buchgr added this in 755e29d with the note "This change is in preparation for adding remote execution capabilities
to repository_context.execute()." Maybe @buchgr has more context?

@agluszak
agluszak removed the request for review from buchgr September 2, 2020 13:55
@buchgr

buchgr commented Sep 2, 2020

Copy link
Copy Markdown
Contributor

Hi @agluszak, thanks for picking this up. I think my solution wasn't ideal. I think a better solution is to send a patch to bazel-toolchains and rename their exec_properties attribute [1] to _exec_properties or similar. It won't be a breaking change for bazel-toolchains because the rbe_autoconfig rule is wrapped in a macro. You'll only rename the internal attribute name.

[1] https://github.com/bazelbuild/bazel-toolchains/blob/master/rules/rbe_repo.bzl#L785

@agluszak

agluszak commented Sep 8, 2020

Copy link
Copy Markdown
Contributor Author

Fixed by bazelbuild/bazel-toolchains#912

@agluszak agluszak closed this Sep 8, 2020
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.

5 participants