provenance.proto 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. // Copyright 2019 The Grafeas Authors. All rights reserved.
  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. syntax = "proto3";
  15. package grafeas.v1;
  16. import "google/protobuf/timestamp.proto";
  17. option go_package = "google.golang.org/genproto/googleapis/grafeas/v1;grafeas";
  18. option java_multiple_files = true;
  19. option java_package = "io.grafeas.v1";
  20. option objc_class_prefix = "GRA";
  21. // Provenance of a build. Contains all information needed to verify the full
  22. // details about the build from source to completion.
  23. message BuildProvenance {
  24. // Required. Unique identifier of the build.
  25. string id = 1;
  26. // ID of the project.
  27. string project_id = 2;
  28. // Commands requested by the build.
  29. repeated Command commands = 3;
  30. // Output of the build.
  31. repeated Artifact built_artifacts = 4;
  32. // Time at which the build was created.
  33. google.protobuf.Timestamp create_time = 5;
  34. // Time at which execution of the build was started.
  35. google.protobuf.Timestamp start_time = 6;
  36. // Time at which execution of the build was finished.
  37. google.protobuf.Timestamp end_time = 7;
  38. // E-mail address of the user who initiated this build. Note that this was the
  39. // user's e-mail address at the time the build was initiated; this address may
  40. // not represent the same end-user for all time.
  41. string creator = 8;
  42. // URI where any logs for this provenance were written.
  43. string logs_uri = 9;
  44. // Details of the Source input to the build.
  45. Source source_provenance = 10;
  46. // Trigger identifier if the build was triggered automatically; empty if not.
  47. string trigger_id = 11;
  48. // Special options applied to this build. This is a catch-all field where
  49. // build providers can enter any desired additional details.
  50. map<string, string> build_options = 12;
  51. // Version string of the builder at the time this build was executed.
  52. string builder_version = 13;
  53. }
  54. // Source describes the location of the source used for the build.
  55. message Source {
  56. // If provided, the input binary artifacts for the build came from this
  57. // location.
  58. string artifact_storage_source_uri = 1;
  59. // Hash(es) of the build source, which can be used to verify that the original
  60. // source integrity was maintained in the build.
  61. //
  62. // The keys to this map are file paths used as build source and the values
  63. // contain the hash values for those files.
  64. //
  65. // If the build source came in a single package such as a gzipped tarfile
  66. // (.tar.gz), the FileHash will be for the single path to that file.
  67. map<string, FileHashes> file_hashes = 2;
  68. // If provided, the source code used for the build came from this location.
  69. SourceContext context = 3;
  70. // If provided, some of the source code used for the build may be found in
  71. // these locations, in the case where the source repository had multiple
  72. // remotes or submodules. This list will not include the context specified in
  73. // the context field.
  74. repeated SourceContext additional_contexts = 4;
  75. }
  76. // Container message for hashes of byte content of files, used in source
  77. // messages to verify integrity of source input to the build.
  78. message FileHashes {
  79. // Required. Collection of file hashes.
  80. repeated Hash file_hash = 1;
  81. }
  82. // Container message for hash values.
  83. message Hash {
  84. // Required. The type of hash that was performed, e.g. "SHA-256".
  85. string type = 1;
  86. // Required. The hash value.
  87. bytes value = 2;
  88. }
  89. // Command describes a step performed as part of the build pipeline.
  90. message Command {
  91. // Required. Name of the command, as presented on the command line, or if the
  92. // command is packaged as a Docker container, as presented to `docker pull`.
  93. string name = 1;
  94. // Environment variables set before running this command.
  95. repeated string env = 2;
  96. // Command-line arguments used when executing this command.
  97. repeated string args = 3;
  98. // Working directory (relative to project source root) used when running this
  99. // command.
  100. string dir = 4;
  101. // Optional unique identifier for this command, used in wait_for to reference
  102. // this command as a dependency.
  103. string id = 5;
  104. // The ID(s) of the command(s) that this command depends on.
  105. repeated string wait_for = 6;
  106. }
  107. // Artifact describes a build product.
  108. message Artifact {
  109. // Hash or checksum value of a binary, or Docker Registry 2.0 digest of a
  110. // container.
  111. string checksum = 1;
  112. // Artifact ID, if any; for container images, this will be a URL by digest
  113. // like `gcr.io/projectID/imagename@sha256:123456`.
  114. string id = 2;
  115. // Related artifact names. This may be the path to a binary or jar file, or in
  116. // the case of a container build, the name used to push the container image to
  117. // Google Container Registry, as presented to `docker push`. Note that a
  118. // single Artifact ID can have multiple names, for example if two tags are
  119. // applied to one image.
  120. repeated string names = 3;
  121. }
  122. // A SourceContext is a reference to a tree of files. A SourceContext together
  123. // with a path point to a unique revision of a single file or directory.
  124. message SourceContext {
  125. // A SourceContext can refer any one of the following types of repositories.
  126. oneof context {
  127. // A SourceContext referring to a revision in a Google Cloud Source Repo.
  128. CloudRepoSourceContext cloud_repo = 1;
  129. // A SourceContext referring to a Gerrit project.
  130. GerritSourceContext gerrit = 2;
  131. // A SourceContext referring to any third party Git repo (e.g., GitHub).
  132. GitSourceContext git = 3;
  133. }
  134. // Labels with user defined metadata.
  135. map<string, string> labels = 4;
  136. }
  137. // An alias to a repo revision.
  138. message AliasContext {
  139. // The type of an alias.
  140. enum Kind {
  141. // Unknown.
  142. KIND_UNSPECIFIED = 0;
  143. // Git tag.
  144. FIXED = 1;
  145. // Git branch.
  146. MOVABLE = 2;
  147. // Used to specify non-standard aliases. For example, if a Git repo has a
  148. // ref named "refs/foo/bar".
  149. OTHER = 4;
  150. }
  151. // The alias kind.
  152. Kind kind = 1;
  153. // The alias name.
  154. string name = 2;
  155. }
  156. // A CloudRepoSourceContext denotes a particular revision in a Google Cloud
  157. // Source Repo.
  158. message CloudRepoSourceContext {
  159. // The ID of the repo.
  160. RepoId repo_id = 1;
  161. // A revision in a Cloud Repo can be identified by either its revision ID or
  162. // its alias.
  163. oneof revision {
  164. // A revision ID.
  165. string revision_id = 2;
  166. // An alias, which may be a branch or tag.
  167. AliasContext alias_context = 3;
  168. }
  169. }
  170. // A SourceContext referring to a Gerrit project.
  171. message GerritSourceContext {
  172. // The URI of a running Gerrit instance.
  173. string host_uri = 1;
  174. // The full project name within the host. Projects may be nested, so
  175. // "project/subproject" is a valid project name. The "repo name" is the
  176. // hostURI/project.
  177. string gerrit_project = 2;
  178. // A revision in a Gerrit project can be identified by either its revision ID
  179. // or its alias.
  180. oneof revision {
  181. // A revision (commit) ID.
  182. string revision_id = 3;
  183. // An alias, which may be a branch or tag.
  184. AliasContext alias_context = 4;
  185. }
  186. }
  187. // A GitSourceContext denotes a particular revision in a third party Git
  188. // repository (e.g., GitHub).
  189. message GitSourceContext {
  190. // Git repository URL.
  191. string url = 1;
  192. // Git commit hash.
  193. string revision_id = 2;
  194. }
  195. // A unique identifier for a Cloud Repo.
  196. message RepoId {
  197. // A cloud repo can be identified by either its project ID and repository name
  198. // combination, or its globally unique identifier.
  199. oneof id {
  200. // A combination of a project ID and a repo name.
  201. ProjectRepoId project_repo_id = 1;
  202. // A server-assigned, globally unique identifier.
  203. string uid = 2;
  204. }
  205. }
  206. // Selects a repo using a Google Cloud Platform project ID (e.g.,
  207. // winged-cargo-31) and a repo name within that project.
  208. message ProjectRepoId {
  209. // The ID of the project.
  210. string project_id = 1;
  211. // The name of the repo. Leave empty for the default repo.
  212. string repo_name = 2;
  213. }