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

Allow overriding os_family in rbe_autoconfig #935

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions rules/rbe_repo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,11 @@ _rbe_autoconfig = repository_rule(
doc = ("Optional. The Java release version in the container. For " +
" example, 11. Should only be set if java_home is set."),
),
"os_family": attr.string(
doc = ("Optional. The os_family to generate the config for. For example, " +
"Linux or Windows (Mac OS X is not supported at this time). The default is " +
"OS Bazel runs on."),
),
"registry": attr.string(
doc = ("Optional. The registry to pull the container from. For example, " +
"marketplace.gcr.io. The default is the value for the selected " +
Expand Down Expand Up @@ -912,6 +917,7 @@ def rbe_autoconfig(
export_configs = False,
java_home = None,
java_version = None,
os_family = None,
tag = None,
toolchain_config_suite_spec = default_toolchain_config_suite_spec(),
registry = None,
Expand Down Expand Up @@ -1244,6 +1250,7 @@ def rbe_autoconfig(
export_configs = export_configs,
java_home = java_home,
java_version = java_version,
os_family = os_family,
toolchain_config_suite_spec = toolchain_config_suite_spec_stripped,
registry = registry,
repository = repository,
Expand Down
2 changes: 2 additions & 0 deletions rules/rbe_repo/util.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ def os_family(ctx):
Returns:
Returns the name of the OS Family
"""
if ctx.attr.os_family:
return ctx.attr.os_family
os_name = ctx.os.name.lower()
if os_name.find("windows") != -1:
return "Windows"
Expand Down