go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/lucictx/sections.proto (about)

     1  // Copyright 2020 The LUCI Authors.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //      http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  syntax = "proto3";
    16  
    17  package lucictx;
    18  
    19  option go_package = "go.chromium.org/luci/lucictx;lucictx";
    20  
    21  
    22  // LocalAuth is a struct that may be used with the "local_auth" section of
    23  // LUCI_CONTEXT.
    24  message LocalAuth {
    25  	// RPCPort and Secret define how to connect to the local auth server.
    26    uint32 rpc_port = 1 [json_name = "rpc_port"];
    27    bytes secret = 2 [json_name = "secret"];
    28  
    29  	// Accounts and DefaultAccountID defines what access tokens are available.
    30    repeated LocalAuthAccount accounts = 3 [json_name = "accounts"];
    31    string default_account_id = 4 [json_name = "default_account_id"];
    32  }
    33  
    34  // LocalAuthAccount contains information about a service account available
    35  // through a local auth server.
    36  message LocalAuthAccount {
    37    // ID is logical identifier of the account, e.g. "system" or "task".
    38    string id = 1 [json_name = "id"];
    39    // Email is an account email or "-" if not available.
    40    string email = 2 [json_name = "email"];
    41  }
    42  
    43  // Swarming is a struct that may be used with the "swarming" section of
    44  // LUCI_CONTEXT.
    45  message Swarming {
    46    // The user-supplied secret bytes specified for the task, if any. This can be
    47    // used to pass application or task-specific secret keys, JSON, etc. from the
    48    // task triggerer directly to the task. The bytes will not appear on any
    49    // swarming UI, or be visible to any users of the swarming service.
    50    bytes secret_bytes = 1 [json_name = "secret_bytes"];
    51  
    52    // Information of the swarming task.
    53    Task task = 2 [json_name = "task"];
    54  }
    55  
    56  // Task is a struct that contains the information relates to the current task.
    57  message Task {
    58    // Server managing the task.
    59    // E.g. https://chromium-swarm.appspot.com.
    60    string server = 1 [json_name = "server"];
    61  
    62    // ID of the current task.
    63    //
    64    // In the case of a swarming task, this is the id of the overall task, which
    65    // ends with 0.
    66    string task_id = 2 [json_name = "task_id"];
    67  
    68    // A snapshot of dimensions of the bot that is currently running the task at
    69    // the time the task was picked up.
    70    //
    71    // Each element is a string in the format of "<key>:<value>".
    72    // E.g. "id:bot_id".
    73    repeated string bot_dimensions = 3 [json_name = "bot_dimensions"];
    74  }
    75  
    76  // LUCIExe is a struct that may be used with the "luciexe" section of
    77  // LUCI_CONTEXT.
    78  message LUCIExe {
    79    // The absolute path of the base cache directory. This directory MAY be on the
    80    // same filesystem as CWD (but is not guaranteed to be). The available caches
    81    // are described in Buildbucket as CacheEntry messages.
    82    string cache_dir = 1 [json_name = "cache_dir"];
    83  }
    84  
    85  
    86  // Realm is a struct that may be used with the "realm" section of
    87  // LUCI_CONTEXT.
    88  message Realm {
    89    // Realm name of the task.
    90    string name = 1 [json_name = "name"]; // e.g. infra:ci
    91  }
    92  
    93  
    94  // ResultDB is a struct that may be used with the "resultdb" section of
    95  // LUCI_CONTEXT.
    96  message ResultDB {
    97    string hostname = 1 [json_name = "hostname"]; // e.g. results.api.cr.dev
    98  
    99    // The invocation in the current context.
   100    // For example, in a Buildbucket build context, it is the build's invocation.
   101    //
   102    // This is the recommended way to propagate invocation name and update token
   103    // to subprocesses.
   104    ResultDBInvocation current_invocation = 2 [json_name = "current_invocation"];
   105  }
   106  
   107  // ResultDBInvocation is a struct that contains the necessary info to update an
   108  // invocation in the ResultDB service.
   109  message ResultDBInvocation {
   110    string name = 1 [json_name = "name"]; // e.g. "invocations/build:1234567890"
   111    string update_token = 2 [json_name = "update_token"]; // required in all mutation requests
   112  }
   113  
   114  message ResultSink {
   115    // TCP address (e.g. "localhost:62115") where a ResultSink pRPC server is hosted.
   116    string address = 1 [json_name = "address"];
   117  
   118    // secret string required in all ResultSink requests in HTTP header
   119    // `Authorization: ResultSink <auth-token>`
   120    string auth_token = 2 [json_name = "auth_token"];
   121  }
   122  
   123  // Deadline represents an externally-imposed termination criteria for the
   124  // process observing the `LUCI_CONTEXT`.
   125  //
   126  // Additionally, this contains `grace_period` which can be used to communicate how
   127  // long the external process will allow for clean up once it sends
   128  // SIGTERM/Ctrl-Break.
   129  //
   130  // Intermediate applications MUST NOT increase `soft_deadline` or `grace_period`.
   131  //
   132  // If the entire Deadline is missing from `LUCI_CONTEXT`, it should be assumed to
   133  // be:
   134  //     {soft_deadline: infinity, grace_period: 30}
   135  //
   136  // Intermediate applications can 'reserve' portions of `soft_deadline` and
   137  // `grace_period` by reducing them and then enforcing the reduced times.
   138  //
   139  // *** note
   140  // **WARNING:** Reducing `soft_deadline` may adversely affect the parent process's
   141  // ability to accurately assess if `soft_deadline` was exceeded. This could affect
   142  // reporting indicators such as 'timeout occurred', because the child process may
   143  // terminate itself before the parent can send a signal and mark that it has done
   144  // so.
   145  //
   146  // Most applications SHOULD only reserve time from `grace_period`. Those reserving
   147  // from `soft_deadline` should take care to ensure that timeout status will still
   148  // be accurately communicated to their parent process, if that's important for
   149  // the application.
   150  // ***
   151  message Deadline {
   152    // The soft deadline for execution for this context as a 'float' unix
   153    // timestamp (seconds past unix epoch). This is the same as python's
   154    // `time.time()` representation.
   155    //
   156    // If this value is set, processes SHOULD rely on their parent process
   157    // to send SIGTERM/Ctrl-Break at this time.
   158    //
   159    // Parent processes adjusting or setting `soft_deadline` MUST enforce it by
   160    // sending SIGTERM/Ctrl-Break as close to this time as possible, followed
   161    // by SIGKILL/Terminate after `grace_period` additional time.
   162    //
   163    // If `soft_deadline` is 0 consider there to be no stated deadline (i.e.
   164    // infinite).
   165    //
   166    // Processes reading this value can use it to determine if a timeout will
   167    // actually be honored; i.e. if the user asks for 30s to run a process, but
   168    // soft_deadline indicates an end in 10s, your program can react accordingly
   169    // (print warning, adjust user-requested timeout, refuse to run user's
   170    // process, etc.).
   171    //
   172    // Processes can also observe this value in conjunction with
   173    // receiving a signal (i.e. I got a signal after `soft_deadline` then I'm likely
   174    // in a timeout state).
   175    double soft_deadline = 1 [json_name = "soft_deadline"];
   176  
   177    // The amount of time (in fractional seconds), processes in this context have
   178    // time to react to a SIGTERM/Ctrl-Break before being SIGKILL/Terminated.
   179    //
   180    // If an intermediate process has a lot of cleanup work to do after its child
   181    // quits (e.g. flushing stats/writing output files/etc.) it SHOULD reduce this
   182    // value for the child process by an appropriate margin.
   183    double grace_period = 2 [json_name = "grace_period"];
   184  }
   185  
   186  // Buildbucket is a struct that contains the necessary info to update
   187  // a buildbucket build.
   188  //
   189  // It may be used with the "buildbucket" section of LUCI_CONTEXT.
   190  message Buildbucket {
   191    // Buildbucket host name.
   192    // E.g. cr-buildbucket.appspot.com.
   193    string hostname = 1 [json_name = "hostname"];
   194  
   195    // Token to use to schedule child builds for this build.
   196    string schedule_build_token = 2 [json_name = "schedule_build_token"];
   197  }