go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/analysis/proto/v1/sources.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 package luci.analysis.v1; 18 19 import "google/api/field_behavior.proto"; 20 21 option go_package = "go.chromium.org/luci/analysis/proto/v1;analysispb"; 22 23 // Specifies the source code that was tested. 24 message Sources { 25 // The base version of code sources checked out. Mandatory. 26 // If necessary, we could add support for non-gitiles sources here in 27 // future, using a oneof statement. E.g. 28 // oneof system { 29 // GitilesCommit gitiles_commit = 1; 30 // SubversionRevision svn_revision = 4; 31 // ... 32 // } 33 GitilesCommit gitiles_commit = 1; 34 35 // The changelist(s) which were applied upon the base version of sources 36 // checked out. E.g. in commit queue tryjobs. 37 // 38 // At most 10 changelist(s) may be specified here. If there 39 // are more, only include the first 10 and set is_dirty. 40 repeated GerritChange changelists = 2; 41 42 // Whether there were any changes made to the sources, not described above. 43 // For example, a version of a dependency was upgraded before testing (e.g. 44 // in an autoroller recipe). 45 // 46 // Cherry-picking a changelist on top of the base checkout is not considered 47 // making the sources dirty as it is reported separately above. 48 bool is_dirty = 3; 49 } 50 51 // GitilesCommit specifies the position of the gitiles commit an invocation 52 // ran against, in a repository's commit log. More specifically, a ref's commit 53 // log. 54 // 55 // It also specifies the host/project/ref combination that the commit 56 // exists in, to provide context. 57 message GitilesCommit { 58 // The identity of the gitiles host, e.g. "chromium.googlesource.com". 59 // Mandatory. 60 string host = 1; 61 62 // Repository name on the host, e.g. "chromium/src". Mandatory. 63 string project = 2; 64 65 // Commit ref, e.g. "refs/heads/main" from which the commit was fetched. 66 // Not the branch name, use "refs/heads/branch" 67 // Mandatory. 68 string ref = 3; 69 70 // Commit SHA-1, as 40 lowercase hexadecimal characters. Mandatory. 71 string commit_hash = 4; 72 73 // Defines a total order of commits on the ref. 74 // A positive, monotonically increasing integer. The recommended 75 // way of obtaining this is by using the goto.google.com/git-numberer 76 // Gerrit plugin. Other solutions can be used as well, so long 77 // as the same scheme is used consistently for a ref. 78 // Mandatory. 79 int64 position = 5; 80 } 81 82 // A Gerrit patchset. 83 message GerritChange { 84 // Gerrit hostname, e.g. "chromium-review.googlesource.com". 85 string host = 1; 86 87 // Gerrit project, e.g. "chromium/src". 88 string project = 5; 89 90 // Change number, e.g. 12345. 91 int64 change = 2; 92 93 // Patch set number, e.g. 1. 94 int64 patchset = 3; 95 96 // The kind of owner of the changelist. Output only. 97 ChangelistOwnerKind owner_kind = 4 98 [(google.api.field_behavior) = OUTPUT_ONLY]; 99 } 100 101 // Represents a reference in a source control system. 102 message SourceRef { 103 // The source control system used. 104 // Only gitiles is supported at this moment. If other systems need to be 105 // supported in future (e.g. non-gitiles git, subversion, google storage 106 // buckets), they can be added here 107 oneof system { 108 // A branch in gitiles repository. 109 GitilesRef gitiles = 1; 110 } 111 } 112 113 // Represents a branch in a gitiles repository. 114 message GitilesRef { 115 // The gitiles host, e.g. "chromium.googlesource.com". 116 string host = 1; 117 118 // The project on the gitiles host, e.g. "chromium/src". 119 string project = 2; 120 121 // Commit ref, e.g. "refs/heads/main" from which the commit was fetched. 122 // Not the branch name, use "refs/heads/branch" 123 string ref = 3; 124 } 125 126 // A gerrit changelist. 127 message Changelist { 128 // Gerrit hostname, e.g. "chromium-review.googlesource.com". 129 string host = 1; 130 131 // Change number, e.g. 12345. 132 int64 change = 2; 133 134 // Patch set number, e.g. 1. 135 int32 patchset = 3; 136 137 // The kind of owner of the changelist. 138 ChangelistOwnerKind owner_kind = 4; 139 } 140 141 // ChangelistOwner describes the owner of a gerrit changelist. 142 enum ChangelistOwnerKind { 143 // The changelist owner is not known. 144 CHANGELIST_OWNER_UNSPECIFIED = 0; 145 146 // The changelist is owned by a human. 147 HUMAN = 1; 148 149 // The changelist is owned by automation. (E.g. autoroller or 150 // automatic uprev process.) 151 AUTOMATION = 2; 152 }