Skip to content

support disabling --remote_* flags on the command line. #4595

Closed

Description

@sgreenstein

Description of the problem / feature request:

If a flag that defaults to null is passed in .bazelrc or bazel.rc, it is impossible to set it to null on the command line.

Feature requests: what underlying problem are you trying to solve with this feature?

Enable remote caching by default, but be able to disable it on the command line. To do this I specify the remote caching flags in bazel.rc, but wish to override them on the command line, which isn't possible.

Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

bazel.rc:

build --google_credentials=/path/to/key
build --google_default_credentials
build --google_auth_scopes=https://www.googleapis.com/auth/cloud-source-tools
build --bes_backend=buildeventservice.googleapis.com
build --bes_best_effort=false
build --bes_timeout=10s
build --project_id=123456
build --remote_cache=remotebuildexecution.googleapis.com
build --remote_instance_name=projects/myproject
build --spawn_strategy=remote
build --genrule_strategy=remote
build --tls_enabled=1
build --remote_accept_cached=true

It is now impossible to set --google_credentials to null so that it doesn't look for a key:

sgreens@sgreens0$ bazel build ... --google_credentials=
ERROR: Could not open auth credentials file '':  (No such file or directory)
INFO: Streaming Build Event Protocol to buildeventservice.googleapis.com build_request_id: xxx invocation_id: xxx
ERROR: Build Event Protocol upload failed: Could not open auth credentials file '':  (No such file or directory)
java.lang.NullPointerException
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:871)
	at com.google.devtools.build.lib.events.Event.<init>(Event.java:52)
	at com.google.devtools.build.lib.events.Event.error(Event.java:165)
	at com.google.devtools.build.lib.events.Event.error(Event.java:200)
	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:474)
	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:218)
	at com.google.devtools.build.lib.runtime.CommandExecutor.exec(CommandExecutor.java:58)
	at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:851)
	at com.google.devtools.build.lib.server.GrpcServerImpl.access$2100(GrpcServerImpl.java:109)
	at com.google.devtools.build.lib.server.GrpcServerImpl$2.lambda$run$0(GrpcServerImpl.java:916)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
java.lang.NullPointerException
	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:871)
	at com.google.devtools.build.lib.events.Event.<init>(Event.java:52)
	at com.google.devtools.build.lib.events.Event.error(Event.java:165)
	at com.google.devtools.build.lib.events.Event.error(Event.java:200)
	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.execExclusively(BlazeCommandDispatcher.java:474)
	at com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.exec(BlazeCommandDispatcher.java:218)
	at com.google.devtools.build.lib.runtime.CommandExecutor.exec(CommandExecutor.java:58)
	at com.google.devtools.build.lib.server.GrpcServerImpl.executeCommand(GrpcServerImpl.java:851)
	at com.google.devtools.build.lib.server.GrpcServerImpl.access$2100(GrpcServerImpl.java:109)
	at com.google.devtools.build.lib.server.GrpcServerImpl$2.lambda$run$0(GrpcServerImpl.java:916)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

What operating system are you running Bazel on?

Rodete

What's the output of bazel info release?

0.10.0

Have you found anything relevant by searching the web?

https://stackoverflow.com/questions/48652798/how-do-i-unset-flags-set-in-bazelrc/

Activity

  1. self-assigned this
    on Feb 15, 2018
  2. added
    P2
    on Feb 15, 2018
  3. philwo commented on Feb 15, 2018

    @philwo
    Member

    Thanks for the report @sgreenstein! This looks like a pretty straightforward fix. I'll change our options for remote execution / caching to not use null to indicate the default, but instead an empty string.

  4. philwo commented on Feb 15, 2018

    @philwo
    Member
  5. assigned and unassigned on Mar 7, 2018
  6. buchgr commented on Mar 7, 2018

    @buchgr
    Contributor

    will fix.

  7. added this to the Remote Execution milestone on Aug 6, 2018
  8. changed the title [-]Flags specified in bazel.rc cannot be set back to null[/-] [+]support disabling --remote_* flags on the command line.[/+] on Jan 16, 2019
  9. added
    team-Remote-Exec
    and removed on Jan 16, 2019
  10. removed their assignment
    on Jan 9, 2020
  11. removed this from the Remote Execution milestone on May 12, 2020
  12. added this to the Bazel Offline Mode milestone on Dec 11, 2021
  13. jparismorgan commented on Jul 11, 2022

    @jparismorgan

    Hi there, I am also impacted by the same issue. @philwo / @buchgr, do you know if this is still planned to be fixed? @sgreenstein, did you find a workaround to this? Thanks!

  14. added
    untriaged
    and removed
    P2
    on Jun 13, 2024
  15. added
    P2
    and removed
    untriaged
    on Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2team-Remote-Exectype: bugtype: feature request

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions