go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/cipkg/core/specs.proto (about)

     1  // Copyright 2023 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  option go_package = "go.chromium.org/luci/cipkg/core";
    18  
    19  // ActionCommand executes the command directly.
    20  // Template is supported in both args and env: {{.depName}} will be replaced by
    21  // the output path of the action's dependency with depName.
    22  // e.g. An ActionCommand with python3 as dependency:
    23  // &core.Action{
    24  //   Name: "some_script",
    25  //   Deps: []*core.Action_Dependency{Python3Action},
    26  //   Spec: &core.Action_Command{
    27  //     Command: &core.ActionCommand{
    28  //       Args: []string{"{{.python3}}/bin/python3", "something.py")},
    29  //     },
    30  //   }
    31  // }
    32  // "{{.python3}}/bin/python3" will be replaced by the output path in the
    33  // transformed derivation.
    34  message ActionCommand {
    35    repeated string args = 1;
    36    repeated string env = 2;
    37  }
    38  
    39  // ActionURLFetch downloads from url into output directory with name
    40  // 'file'.
    41  message ActionURLFetch {
    42    // HTTP(s) url for the remote resource.
    43    string url = 1;
    44    // HashAlgorithm is the hash function used to calculate hash value.
    45    HashAlgorithm hash_algorithm = 2;
    46    // HashValue is the lower-case text representation for the hex value of the
    47    // hash sum.
    48    string hash_value = 3;
    49  }
    50  
    51  // ActionFilesCopy copies listed files into the output directory.
    52  // TODO(fancl): Local, Embed, Output can be separated into different specs?
    53  message ActionFilesCopy {
    54    // Files are the destination-source pairs which is the relative path
    55    // source files should be copied to.
    56    map<string, Source> files = 1;
    57  
    58    // Source defines the source file we want to copied from.
    59    message Source {
    60      uint32 mode = 1;
    61      oneof content {
    62        // Raw contains the literal content of the file.
    63        bytes raw = 2;
    64        // Local refers to the local file.
    65        Local local = 3;
    66        // Embed refers to the embedded file in the go binary.
    67        Embed embed = 4;
    68        // Output refers to the output file from other derivations.
    69        Output output = 5;
    70      }
    71  
    72      message Local {
    73        // Path is the local filesystem absolute path to the file.
    74        string path = 1;
    75        // Version is the version string for the file.
    76        string version = 2;
    77        // Follow_symlinks, if set to true, will follow all the symlinks in the
    78        // directories while copying.
    79        bool follow_symlinks = 3;
    80      }
    81      message Embed {
    82        // Ref is the reference to the embed.FS.
    83        string ref = 1;
    84        // Path is the relative path to the file inside the embedded filesystem.
    85        string path = 2;
    86      }
    87      message Output {
    88        // Name is the output action's Metadata.Name
    89        string name = 1;
    90        // Path is the relative path to the file inside the output.
    91        string path = 2;
    92      }
    93    }
    94  }
    95  
    96  // ActionCIPDExport exports cipd packages to the output directory.
    97  // NOTE: this uses cipd export subcommand, which only includes CIPD package
    98  // content without any cipd tracking metadata.
    99  // TODO(fancl): use a protobuf ensure file instead.
   100  message ActionCIPDExport {
   101    // Ensure_file is the serialized text ensure file for cipd.
   102    string ensure_file = 1;
   103    // Env is the extra environment variables passed to the cipd process.
   104    repeated string env = 2;
   105  }
   106  
   107  // HashAlgorithm includes all supported hash algorithms shared by actions.
   108  enum HashAlgorithm {
   109    HASH_UNSPECIFIED = 0;
   110    HASH_MD5 = 1;
   111    HASH_SHA256 = 2;
   112  }