github.com/distbuild/reclient@v0.0.0-20240401075343-3de72e395564/docs/cmd-line-flags.md (about)

     1  # Command-line Flags for re-client binaries
     2  
     3  ### Reproxy
     4  
     5  **`-service (string)`**
     6  
     7  Sets the host (and port) of the remote execution service to connect to.
     8  
     9  **`-cas_service (string)`**
    10  
    11  Sets the host (and port) of the Content Addressable Service to connect to, if it
    12  is different from the remote execution service. If using the Remote Build
    13  Execution service, this will be the same as the remote execution service and
    14  does not need to be set.
    15  
    16  **`-instance (string)`**
    17  
    18  The instance to target when calling the remote execution service via gRPC. For
    19  Remote Build Execution, the format is
    20  `projects/_project-id_/instances/_instance-name_`.
    21  
    22  **`-use_application_default_credentials (bool) (from remote-apis-sdks)`**
    23  
    24  If true, this indicates that reproxy should use application default credentials
    25  to authenticate with the Remote Execution service. See Notes on credentials and
    26  authentication below.
    27  
    28  **`-use_gce_credentials (bool) (from remote-apis-sdks)`**
    29  
    30  If true, this indicates that the GCE credentials should be used to authenticate
    31  with the Remote Build Execution service. Use of this flag only works when
    32  reproxy is running on a GCE VM. See Notes on credentials and authentication
    33  below.
    34  
    35  **`-credential_file (string) (from remote-apis-sdks)`**
    36  
    37  If set, points to a file containing the service account credentials to use to
    38  authenticate with the Remote Build Execution service. See notes on credentials
    39  and authentication below.
    40  
    41  **`-server_address (string)`**
    42  
    43  The address that reproxy will use to accept actions from rewrapper. Can be
    44  either in host:port format (ex: 127.0.0.1:8000) or unix:///file for unix domain
    45  sockets (ex: unix:///tmp/reproxy.sock).
    46  
    47  **`-log_format (string)`**
    48  
    49  File format of the proxy logs. Currently only supports 'text'.
    50  
    51  **`-log_path (string) (DEPRECATED)`**
    52  
    53  If this is set, this is the path to a log file of all executed records. The
    54  format for this flag is 'text://full/file/path'. The `proxy_log_dir` flag should
    55  be used in place of this one.
    56  
    57  **`-local_resource_fraction (float)`**
    58  
    59  A value between 0 and 1 that indicates how much of the local machine resources
    60  can be used for local execution. A value of 1 means all CPUs are available, and
    61  0 means no CPUs are available.
    62  
    63  **`-enable_deps_cache (bool)`**
    64  
    65  Enables the deps cache if `-cache_dir` is provided. Default is false.
    66  
    67  **`-cache_dir`**
    68  
    69  Directory from which to load the cache files at startup and update at shutdown.
    70  
    71  **`-cache_silo (string)`**
    72  
    73  A cache silo key to use for all actions. Can be used to segregate cache hits.
    74  
    75  **`-version_cache_silo (bool)`**
    76  
    77  Indicates whether to add a Reclient version as cache-silo key to all
    78  remotely-executed actions. Not applicable for actions run in
    79  local-execution-remote-cache (LERC) mode. Default is false.
    80  
    81  **`-remote_disabled (bool)`**
    82  
    83  If this is set, then all remote actions are not permitted and everything
    84  executes locally. This includes both remote cache lookups and remote execution
    85  of actions.
    86  
    87  **`-dump_input_tree (bool)`**
    88  
    89  If true, this will dump the input tree of actions received from rewrapper to
    90  '/tmp'. Not useful unless you are attempting to debug an issue suspected to be
    91  caused by rbe.
    92  
    93  **`-use_unified_uploads (bool)`**
    94  
    95  Whether to use the unified uploader for deduplicating uploads. Default is false.
    96  
    97  **`-upload_buffer_size (int)`**
    98  
    99  Buffer size to flush unified uploader daemon. Default is 10000.
   100  
   101  **`-upload_tick_duration (duration)`**
   102  
   103  How often to flush unified uploader daemon. Default is 50ms.
   104  
   105  **`-use_unified_downloads (bool)`**
   106  
   107  Whether to use the unified downloader for deduplicating downloads. Default is
   108  false.
   109  
   110  **`-download_buffer_size (int)`**
   111  
   112  Buffer size to flush unified downloader daemon. Default is 10000.
   113  
   114  **`-download_tick_duration (duration)`**
   115  
   116  How often to flush unified downloader daemon. Default is 50ms.
   117  
   118  **`-compression_threshold (int)`**
   119  
   120  Threshold size in bytes for compressing Bytestream reads or writes. Use a
   121  negative value for turning off compression. Default is -1.
   122  
   123  **`-use_batches (bool)`**
   124  
   125  Use batch operations for relatively small blobs. Default is true.
   126  
   127  **`-log_keep_duration (duration)`**
   128  
   129  Delete all RE logs older than the specified duration on startup. Default is 24h.
   130  
   131  **`-proxy_idle_timeout (duration)`**
   132  
   133  Inactivity period after which the running reproxy process will be killed.
   134  Default is 6 hours. When set to 0, idle timeout is disabled.
   135  
   136  **`-ip_timeout (duration)`**
   137  
   138  The maximum time to wait for an input processor action. Zero and negative values
   139  disable timeout. Default is 10m.
   140  
   141  **`-metrics_project (string)`**
   142  
   143  If set, action and build metrics are exported to Cloud Monitoring in the
   144  specified GCP project. Default is empty.
   145  
   146  **`-metrics_prefix (string)`**
   147  
   148  Prefix of metrics exported to Cloud Monitoring. Default is empty.
   149  
   150  **`-metrics_namespace (string)`**
   151  
   152  Namespace of metrics exported to Cloud Monitoring. Default is empty.
   153  
   154  **`-fail_early_min_action_count (int)`**
   155  
   156  Minimum number of actions received by reproxy before the fail early mechanism
   157  can take effect. 0 indicates fail early is disabled.
   158  
   159  **`-fail_early_min_fallback_ratio (float)`**
   160  
   161  Minimum ratio of fallbacks to total actions above which the build terminates
   162  early. Ratio is a number in the range between 0 and 1. 0 indicates fail early is
   163  disabled. Default is 0.
   164  
   165  **`-fail_early_window (duration)`**
   166  
   167  Window of time to consider for fail_early_min_action_count and
   168  fail_early_min_fallback_ratio. 0 indicates all datapoints should be used.
   169  Default is 0.
   170  
   171  **`-racing_bias (float)`**
   172  
   173  Value between 0 and 1 to indicate how racing manages the tradeoff of saving
   174  bandwidth (0) versus speed (1). The default is to prefer speed over bandwidth.
   175  Default is 0.75.
   176  
   177  **`-racing_tmp_dir (string)`**
   178  
   179  Directory where reproxy should store temporary outputs during racing mode. This
   180  should be on the same device as the exec root for the build. Default is
   181  [`os.TempDir()`](https://pkg.go.dev/os#TempDir).
   182  
   183  **`-pprof_port (int)`**
   184  
   185  "Enable pprof http server if not zero. Default is 0.
   186  
   187  **`-pprof_file (path)`**
   188  
   189  Enable cpu pprof if not empty. Will not work on windows as reproxy shutdowns
   190  through an uncatchable sigkill. Default is empty.
   191  
   192  **`-pprof_mem_file (path)`**
   193  
   194  Enable memory pprof if not empty. Will not work on windows as reproxy shutdowns
   195  through an uncatchable sigkill. Default is empty.
   196  
   197  **`-profiler_service (string)`**
   198  
   199  Service name to associate with profiles uploaded to Cloud Profiling. If unset,
   200  Cloud Profiling is disabled. Default is empty.
   201  
   202  **`-profiler_project_id (string)`**
   203  
   204  Project id used for cloud profiler. Default is empty.
   205  
   206  **`-clang_depscan_archive (bool)`**
   207  
   208  Deep scan .a files for dependencies during clang linking. Default is false.
   209  
   210  **`-depsscanner_address (string)`**
   211  
   212  If set, connects to the given address for C++ dependency scanning instead of the
   213  internal dependency scanner; a path with the prefix 'exec://' will start the
   214  target executable and connect to it. If set to execrel:// the `scandeps_server`
   215  binary in the same folder as reproxy will be used. Default is empty.
   216  
   217  **`-creds_file (path)`**
   218  
   219  Path to file where short-lived credentials are stored. If the file includes a
   220  token, reproxy will update the token if it refreshes it. Token refresh is only
   221  applicable if `use_external_auth_token` is used. Default is empty.
   222  
   223  **`-wait_for_shutdown_rpc (bool)`**
   224  
   225  If set, will only shutdown after 3 SIGINT signals. Default is false.
   226  
   227  **`-proxy_log_dir (path)`**
   228  
   229  If set, this is where reproxy will write a log of executed records.
   230  
   231  **`-xattr_digest (string)`**
   232  
   233  Extended file attribute to obtain the digest from, if available, formatted as
   234  hash/size. If the value contains the hash only, the file size as reported by
   235  stat is used. Default is empty.
   236  
   237  **`clang_depscan_ignored_plugins (comma-separated list of strings)`**
   238  
   239  Comma-separated list of plugins that should be ignored by clang dependency
   240  scanner. Use this flag if you're using custom llvm build as your toolchain and
   241  your llvm plugins cause dependency scanning failures. Default is empty.
   242  
   243  **`-v (int)`**
   244  
   245  Logging verbosity. A higher number means more logging.
   246  
   247  ### Rewrapper
   248  
   249  **`-server_address (string)`**
   250  
   251  The address that reproxy will use to accept actions from rewrapper. Can be
   252  either in host:port format (ex: 127.0.0.1:8000) or unix:///file for unix domain
   253  sockets (ex: unix:///tmp/reproxy.sock).
   254  
   255  **`-command_id (string)`**
   256  
   257  An identifier to place in the command to aid in debugging.
   258  
   259  **`-invocation_id (string)`**
   260  
   261  An identifier for a group of commands to aid in debugging.
   262  
   263  **`-tool_name (string)`**
   264  
   265  The name of the tool to associate with executed commands.
   266  
   267  **`-labels (comma-separated key-value pairs)`**
   268  
   269  A set of key=value comma-separated pairs, used by reproxy to make decisions on
   270  how execution of the command should be handled. See
   271  [labels.go](https://github.com/bazelbuild/reclient/tree/main/internal/pkg/labels/labels.go)
   272  for the current set of keys and their accepted values.
   273  
   274  **`-exec_root (path)`**
   275  
   276  Absolute path to the root of the source tree for the project being built. All
   277  inputs and outputs are relative to this path.
   278  
   279  **`-exec_timeout (duration)`**
   280  
   281  The amount of time to allow this command to execute. The default is 1 hour.
   282  
   283  **`-platform (comma-separated key-value pairs)`**
   284  
   285  A set of key=value comma-separated pairs, used to define the remote platform
   286  settings (such as the docker container) used to execute the command.
   287  
   288  **`-env_var_allowlist (comma-separated strings)`**
   289  
   290  A list of comma-separated strings that list the environment variables that
   291  should be passed from rewrapper to reproxy.
   292  
   293  **`-inputs (comma-separated paths)`**
   294  
   295  A comma-separated list of paths, relative to the `exec_root`, to files or
   296  directories that should be included in the upload to the remote worker.
   297  
   298  **`-toolchain_inputs (comma-separated paths)`**
   299  
   300  A comma-separated list of command toolchain inputs relative to the `exec_root`,
   301  which are paths to binaries needed to execute the action. Each binary can have a
   302  `<binary>_remote_toolchain_inputs` file next to it to refer to all dependencies
   303  of the toolchain binary. Paths in the `<binary>_remote_toolchain_inputs` file
   304  should be normalized, and should have one path per line.
   305  
   306  **`-input_list_paths (comma-separated paths)`**
   307  
   308  A comma-separated list of paths to input files (rsp files). Useful for cases
   309  where the use of the -input flag produces excessively long command-lines.
   310  
   311  **`-output_files (comma-separated file paths)`**
   312  
   313  A comma-separated list of paths where output files from the command will be
   314  placed, relative to the `exec_root`.
   315  
   316  **`-output_directories (comma-separated directory paths)`**
   317  
   318  A comma-separated list of paths where output directories from the command will
   319  be placed, relative to the `exec_root`. Unlike `output_files`, the names of the
   320  files within the directory do not need to be known ahead of time. This is useful
   321  for things like log files which may contain a timestamp as part of the file
   322  name.
   323  
   324  **`-exec_strategy (string)`**
   325  
   326  One of `local`, `remote`, `remote_local_fallback` or `racing`.
   327  
   328  *   `local` - Use Local Execution, Remote Caching (LERC). Checks the remote
   329      cache for action matches and uses existing results if a match is found. If
   330      not, execution of the action is performed locally.
   331  *   `remote` - The remote cache is checked for an action match, and uses the
   332      results if one exists. If not, the action is executed remotely. If the
   333      action fails remotely, the action is considered a failure.
   334  *   `remote_local_fallback` - Similar to `remote`, but will attempt to retry a
   335      failing remote action locally.
   336  *   `racing` - If a remote action doesn't complete within a certain amount of
   337      time and there are sufficient local resources available, will start running
   338      the action locally as well. The results of the first to finish are used.
   339      This is intended to improve the build times for short incremental builds one
   340      might do as a developer.
   341  
   342  **`-compare (bool)`**
   343  
   344  Compares the chosen execution strategy to local execution. Is used to determine
   345  if remote execution is producing different results from local. Defaults to
   346  false.
   347  
   348  **`-remote_accept_cache (bool)`**
   349  
   350  Indicates if remote cache hits should be used. Defaults to true.
   351  
   352  **`-remote_update_cache (bool)`**
   353  
   354  Indicates if the remote cache should be updated with the results of executed
   355  commands. Defaults to true.
   356  
   357  **`-download_outputs (bool)`**
   358  
   359  Determines if the results of a remote action should be downloaded. Defaults to
   360  true.
   361  
   362  **`-log_env (bool)`**
   363  
   364  If true, passes the entire environment to reproxy for logging purposes. Defaults
   365  to false.
   366  
   367  **`-dial_timeout (duration)`**
   368  
   369  Timeout for attempting to dial into reproxy. Default is 3 minutes.
   370  
   371  ### Bootstrap
   372  
   373  **`-server_address (string)`**
   374  
   375  The address that reproxy will use to accept actions from rewrapper. Can be
   376  either in host:port format (ex: 127.0.0.1:8000) or unix:///file for unix domain
   377  sockets (ex: unix:///tmp/reproxy.sock).
   378  
   379  **`-re_proxy (path)`**
   380  
   381  Location of the reproxy binary. The full path including the binary name, not
   382  just the directory that contains it. Defaults to $HOME/rbe/reproxy.
   383  
   384  **`-reproxy_wait_seconds (int)`**
   385  
   386  Number of seconds to wait for reproxy to start. If reproxy fails to start in the
   387  allotted time, an error is returned. Defaults to 20 seconds.
   388  
   389  **`-shutdown (bool)`**
   390  
   391  If provided, will shut down reproxy and dump the stats collected to
   392  `rbe_metrics.txt` and `rbe_metrics.pb` files.
   393  
   394  **`-log_format (string)`**
   395  
   396  Format of proxy log. Currently only text and reducedtext are supported. Defaults
   397  to reducedtext.
   398  
   399  **`-log_path (string) (DEPRECATED)`**
   400  
   401  If this is set, this is the path to a log file of all executed records. The
   402  format for this flag is 'text://full/file/path'. The `proxy_log_dir` flag should
   403  be used in place of this one.
   404  
   405  **`-output_dir (path)`**
   406  
   407  Directory where metrics should be written. Defaults to
   408  [`os.TempDir()`](https://pkg.go.dev/os#TempDir).
   409  
   410  **`-v (int)`**
   411  
   412  Logging verbosity. A higher number means more logging.
   413  
   414  ### Dumpstats
   415  
   416  **`-shutdown_proxy (bool)`**
   417  
   418  If set to true, this will shut down reproxy before reading the reproxy log files
   419  (\*.rpl) for generating metrics.
   420  
   421  **`-server_address (string)`**
   422  
   423  The address that reproxy will use to accept actions from rewrapper. Can be
   424  either in host:port format (ex: 127.0.0.1:8000) or unix:///file for unix domain
   425  sockets (ex: unix:///tmp/reproxy.sock).
   426  
   427  **`-log_format (string)`**
   428  
   429  Format of proxy log. Currently only text and reducedtext are supported. Defaults
   430  to reducedtext.
   431  
   432  **`-log_path (string) (DEPRECATED)`**
   433  
   434  If this is set, this is the path to a log file of all executed records. The
   435  format for this flag is 'text://full/file/path'. The `proxy_log_dir` flag should
   436  be used in place of this one.
   437  
   438  **`-output_dir (path)`**
   439  
   440  Directory where metrics should be written. Defaults to /tmp.
   441  
   442  **`-v (int)`**
   443  
   444  Logging verbosity. A higher number means more logging.
   445  
   446  ## Setting flags via environment variables
   447  
   448  Any of these flags can be set via an environment variable of the form
   449  `RBE_<flagname>` where `<flagname>` is a flag defined above. For example, you
   450  could set the `server_address` of reproxy with the following:
   451  
   452  ```
   453  export RBE_server_address=unix:///tmp/reproxy.sock
   454  ```
   455  
   456  ## Notes on credentials and authentication ([source](https://github.com/bazelbuild/remote-apis-sdks/blob/master/go/pkg/flags/flags.go))
   457  
   458  The flags `credential_file`, `use_application_default_credentials`, and
   459  `use_gce_credentials` determine the client identity that is used to authenticate
   460  with remote execution. One of the following must be true for client
   461  authentication to work, and they are used in this order of preference:
   462  
   463  *   the `use_application_default_credentials` flag must be set to true, or
   464  *   the `use_gce_credentials` must be set to true, or
   465  *   the `credential_file` flag must be set to point to a valid credential file
   466  
   467  ## Passing variables in build systems
   468  
   469  Note that in some build systems not all variables/flags are allowed to be passed
   470  to each binary. For example, in Android, there are certain variables that do not
   471  get passed to rewrapper, but all variables are allowed to be passed to reproxy.
   472  Just something to be aware of!