github.com/bazelbuild/remote-apis-sdks@v0.0.0-20240425170053-8a36686a6350/go/api/command/command.proto (about)

     1  syntax = "proto3";
     2  
     3  package cmd;
     4  
     5  import "google/protobuf/timestamp.proto";
     6  import "google/protobuf/wrappers.proto";
     7  
     8  // A command to execute locally or remotely.
     9  message Command {
    10    // Identifiers used to identify this command to be passed to RE.
    11    Identifiers identifiers = 1;
    12  
    13    // An absolute path to the execution root of the command. All the other paths are
    14    // specified relatively to this path.
    15    string exec_root = 2;
    16  
    17    // The command inputs.
    18    InputSpec input = 3;
    19  
    20    // The command outputs.
    21    OutputSpec output = 4;
    22  
    23    // Command line elements to execute.
    24    repeated string args = 5;
    25  
    26    // If > 0, the maximum number of seconds to wait for command execution
    27    // before timing out.
    28    int32 execution_timeout = 6;
    29  
    30    // The working directory, relative to the exec root, for the command to run
    31    // in. It must be a directory which exists in the input tree. If it is left
    32    // empty, then the action is run in the exec root.
    33    string working_directory = 7;
    34  
    35    // The platform to use for the remote execution.
    36    map<string,string> platform = 8;
    37  
    38    // The working directory when executing the command on RE server.
    39    // It's relative to exec root and, if provided, needs to have the same number of levels
    40    // as WorkingDir. If not provided, the remote command is run from the WorkingDir
    41    string remote_working_directory = 9;
    42  }
    43  
    44  // Identifiers identifying a command that are passed to the remote server for logging.
    45  message Identifiers {
    46    // An optional id to use to identify a command.
    47    string command_id = 1;
    48  
    49    // An optional id to use to identify an invocation.
    50    string invocation_id = 2;
    51  
    52    // An optional id to use to identify a build.
    53    string correlated_invocations_id = 3;
    54  
    55    // An optional tool name to pass to the remote server for logging.
    56    string tool_name = 4;
    57  
    58    // An optional tool version to pass to the remote server for logging.
    59    string tool_version = 5;
    60  
    61    // An optional ID identifying a particular execution of this command.
    62    string execution_id = 6;
    63  }
    64  
    65  message InputType {
    66    enum Value {
    67       // Any type will match.
    68       UNSPECIFIED = 0;
    69       // Only directories match.
    70       DIRECTORY = 1;
    71       // Only files match.
    72       FILE = 2;
    73    }
    74  }
    75  
    76  message ExcludeInput {
    77    // If an input matches this regular expression, ignore it.
    78    string regex = 1;
    79    // If an input path has this type, ignore it.
    80    InputType.Value type = 2;
    81  }
    82  
    83  // VirtualInput represents an input that may exist on disk but shouldn't be accessed.
    84  // We want to stage it on disk for the command execution.
    85  message VirtualInput {
    86    // The path for the input file to be staged at, relative to the ExecRoot.
    87    string path = 1;
    88    // The byte contents of the file to be staged.
    89    bytes contents = 2;
    90    // Whether the file should be staged as executable.
    91    bool is_executable = 3;
    92    // Whether the input is an empty directory.
    93    bool is_empty_directory = 4;
    94    // The digest of the virtual input that is expected to exist in the CAS.
    95    string digest = 5;
    96    // Mtime of the virtual input represented as a Unix Timestamp.
    97    google.protobuf.Timestamp mtime = 6;
    98    // The virtual inputs' mode and permissions bits.
    99    uint32 filemode = 7;
   100  }
   101  
   102  message SymlinkBehaviorType {
   103    enum Value {
   104      // Use Client.TreeSymlinkOpts or default if it is not set.
   105      UNSPECIFIED = 0;
   106      // Resolves symlinks.
   107      RESOLVE = 1;
   108      // Preserve symlinks as-is.
   109      PRESERVE = 2;
   110    }
   111  }
   112  
   113  message InputSpec {
   114    // Input paths (files or directories) that need to be uploaded to the remote
   115    // server for the command execution.
   116    // Note: a known limitation of the first version of the proxy is that for any
   117    // *directory* inputs, the contents of the directory will only be read once,
   118    // and then cached throughout the proxy lifetime. Any subsequent changes to the
   119    // directory will therefore not be captured.
   120    repeated string inputs = 2;
   121  
   122    // Virtual inputs that need to be staged as if they were present on disk.
   123    repeated VirtualInput virtual_inputs = 5;
   124  
   125    // Inputs matching these patterns will be excluded (not uploaded remotely).
   126    repeated ExcludeInput exclude_inputs = 3;
   127  
   128    // Environment variables the command relies on.
   129    map<string,string> environment_variables = 4;
   130  
   131    // Determines how symlinks should be treated when constructing the input tree.
   132    SymlinkBehaviorType.Value symlink_behavior = 6;
   133  
   134    // Node properties of inputs.
   135    map<string,NodeProperties> input_node_properties = 7;
   136  }
   137  
   138  // A copy of NodeProperties from https://github.com/bazelbuild/remote-apis/blob/main/build/bazel/remote/execution/v2/remote_execution.proto
   139  // to avoid importing it as a proto dependency.
   140  // Importing the messages causes resource exhaustion on high parallelism builds.
   141  message NodeProperties {
   142    // A list of string-based
   143    // [NodeProperties][build.bazel.remote.execution.v2.NodeProperty].
   144    repeated NodeProperty properties = 1;
   145  
   146    // The file's last modification timestamp.
   147    google.protobuf.Timestamp mtime = 2;
   148  
   149    // The UNIX file mode, e.g., 0755.
   150    google.protobuf.UInt32Value unix_mode = 3;
   151  }
   152  
   153  // A copy of NodeProperty from https://github.com/bazelbuild/remote-apis/blob/main/build/bazel/remote/execution/v2/remote_execution.proto
   154  // to avoid importing it as a proto dependency.
   155  // Importing the messages causes resource exhaustion on high parallelism builds.
   156  message NodeProperty {
   157      // The property name.
   158      string name = 1;
   159  
   160      // The property value.
   161      string value = 2;
   162  }
   163  
   164  message OutputSpec {
   165    // Output files relative to working directory generated by the command.
   166    repeated string output_files = 1;
   167  
   168    // Output directories relative to working directory generated by the command.
   169    repeated string output_directories = 2;
   170  }
   171  
   172  message CommandResultStatus {
   173    enum Value {
   174      // Default case. Should not be used.
   175      UNKNOWN = 0;
   176      // Command executed successfully.
   177      SUCCESS = 1;
   178      // The command did not execute and a previously cached result was
   179      // retrieved.
   180      CACHE_HIT = 2;
   181      // The command executed with a non zero exit code.
   182      NON_ZERO_EXIT = 3;
   183      // The command timed out.
   184      TIMEOUT = 4;
   185      // The command was interrupted.
   186      INTERRUPTED = 5;
   187      // Execution of the command failed due to a remote execution error.
   188      REMOTE_ERROR = 6;
   189      // Execution of the command failed due to a local execution error.
   190      LOCAL_ERROR = 7;
   191    }
   192  }
   193  
   194  // Result of a command execution returned by the proxy.
   195  message CommandResult {
   196    // Status of the finished run.
   197    CommandResultStatus.Value status = 1;
   198  
   199    // Command exit code.
   200    int32 exit_code = 2;
   201  
   202    // Optional exception trace or other message that should be displayed.
   203    string msg = 3;
   204  }
   205  
   206  // TimeInterval is used to serialize the SDK TimeInterval struct.
   207  message TimeInterval {
   208    google.protobuf.Timestamp from = 1;
   209    google.protobuf.Timestamp to = 2;
   210  }