1
- // Copyright 2020 Google LLC
1
+ // Copyright 2021 Google LLC
2
2
//
3
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
4
// you may not use this file except in compliance with the License.
@@ -19,6 +19,7 @@ package google.devtools.cloudbuild.v1;
19
19
import "google/api/annotations.proto" ;
20
20
import "google/api/client.proto" ;
21
21
import "google/api/field_behavior.proto" ;
22
+ import "google/api/httpbody.proto" ;
22
23
import "google/api/resource.proto" ;
23
24
import "google/longrunning/operations.proto" ;
24
25
import "google/protobuf/duration.proto" ;
@@ -40,6 +41,18 @@ option (google.api.resource_definition) = {
40
41
type : "iam.googleapis.com/ServiceAccount"
41
42
pattern : "projects/{project}/serviceAccounts/{service_account}"
42
43
};
44
+ option (google.api.resource_definition ) = {
45
+ type : "secretmanager.googleapis.com/Secret"
46
+ pattern : "projects/{project}/secrets/{secret}"
47
+ };
48
+ option (google.api.resource_definition ) = {
49
+ type : "secretmanager.googleapis.com/SecretVersion"
50
+ pattern : "projects/{project}/secrets/{secret}/versions/{version}"
51
+ };
52
+ option (google.api.resource_definition ) = {
53
+ type : "cloudkms.googleapis.com/CryptoKey"
54
+ pattern : "projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}"
55
+ };
43
56
44
57
// Creates and manages builds on Google Cloud Platform.
45
58
//
@@ -65,7 +78,7 @@ service CloudBuild {
65
78
body : "build"
66
79
additional_bindings {
67
80
post : "/v1/{parent=projects/*/locations/*}/builds"
68
- body : "* "
81
+ body : "build "
69
82
}
70
83
};
71
84
option (google.api.method_signature ) = "project_id,build" ;
@@ -223,6 +236,16 @@ service CloudBuild {
223
236
};
224
237
}
225
238
239
+ // ReceiveTriggerWebhook [Experimental] is called when the API receives a
240
+ // webhook request targeted at a specific trigger.
241
+ rpc ReceiveTriggerWebhook (ReceiveTriggerWebhookRequest )
242
+ returns (ReceiveTriggerWebhookResponse ) {
243
+ option (google.api.http ) = {
244
+ post : "/v1/projects/{project_id}/triggers/{trigger}:webhook"
245
+ body : "body"
246
+ };
247
+ }
248
+
226
249
// Creates a `WorkerPool` to run the builds, and returns the new worker pool.
227
250
//
228
251
// This API is experimental.
@@ -274,8 +297,8 @@ message RunBuildTriggerRequest {
274
297
// Required. ID of the trigger.
275
298
string trigger_id = 2 [(google.api.field_behavior ) = REQUIRED ];
276
299
277
- // Required. Source to build against this trigger.
278
- RepoSource source = 3 [ (google.api .field_behavior ) = REQUIRED ] ;
300
+ // Source to build against this trigger.
301
+ RepoSource source = 3 ;
279
302
}
280
303
281
304
// Location of the source in an archive file in Google Cloud Storage.
@@ -302,7 +325,7 @@ message RepoSource {
302
325
// project ID requesting the build is assumed.
303
326
string project_id = 1 ;
304
327
305
- // Required. Name of the Cloud Source Repository.
328
+ // Name of the Cloud Source Repository.
306
329
string repo_name = 2 ;
307
330
308
331
// A revision within the Cloud Source Repository must be specified in
@@ -525,6 +548,7 @@ message ArtifactResult {
525
548
// build is created:
526
549
//
527
550
// - $PROJECT_ID: the project ID of the build.
551
+ // - $PROJECT_NUMBER: the project number of the build.
528
552
// - $BUILD_ID: the autogenerated ID of the build.
529
553
// - $REPO_NAME: the source repository name specified by RepoSource.
530
554
// - $BRANCH_NAME: the branch name specified by RepoSource.
@@ -669,6 +693,10 @@ message Build {
669
693
repeated string tags = 31 ;
670
694
671
695
// Secrets to decrypt using Cloud Key Management Service.
696
+ // Note: Secret Manager is the recommended technique
697
+ // for managing sensitive data with Cloud Build. Use `available_secrets` to
698
+ // configure builds to access secrets from Secret Manager. For instructions,
699
+ // see: https://cloud.google.com/cloud-build/docs/securing-builds/use-secrets
672
700
repeated Secret secrets = 32 ;
673
701
674
702
// Output only. Stores timing information for phases of the build. Valid keys
@@ -686,10 +714,13 @@ message Build {
686
714
// Must be of the format `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
687
715
// ACCOUNT can be email address or uniqueId of the service account.
688
716
//
689
- // This field is in alpha and is not publicly available .
717
+ // This field is in beta .
690
718
string service_account = 42 [(google.api.resource_reference ) = {
691
719
type : "iam.googleapis.com/ServiceAccount"
692
720
}];
721
+
722
+ // Secrets and secret environment variables.
723
+ Secrets available_secrets = 47 ;
693
724
}
694
725
695
726
// Artifacts produced by a build that should be uploaded upon
@@ -806,8 +837,53 @@ message Hash {
806
837
bytes value = 2 ;
807
838
}
808
839
840
+ // Secrets and secret environment variables.
841
+ message Secrets {
842
+ // Secrets in Secret Manager and associated secret environment variable.
843
+ repeated SecretManagerSecret secret_manager = 1 ;
844
+
845
+ // Secrets encrypted with KMS key and the associated secret environment
846
+ // variable.
847
+ repeated InlineSecret inline = 2 ;
848
+ }
849
+
850
+ // Pairs a set of secret environment variables mapped to encrypted
851
+ // values with the Cloud KMS key to use to decrypt the value.
852
+ message InlineSecret {
853
+ // Resource name of Cloud KMS crypto key to decrypt the encrypted value.
854
+ // In format: projects/*/locations/*/keyRings/*/cryptoKeys/*
855
+ string kms_key_name = 1 [(google.api.resource_reference ) = {
856
+ type : "cloudkms.googleapis.com/CryptoKey"
857
+ }];
858
+
859
+ // Map of environment variable name to its encrypted value.
860
+ //
861
+ // Secret environment variables must be unique across all of a build's
862
+ // secrets, and must be used by at least one build step. Values can be at most
863
+ // 64 KB in size. There can be at most 100 secret values across all of a
864
+ // build's secrets.
865
+ map <string , bytes > env_map = 2 ;
866
+ }
867
+
868
+ // Pairs a secret environment variable with a SecretVersion in Secret Manager.
869
+ message SecretManagerSecret {
870
+ // Resource name of the SecretVersion. In format:
871
+ // projects/*/secrets/*/versions/*
872
+ string version_name = 1 [(google.api.resource_reference ) = {
873
+ type : "secretmanager.googleapis.com/SecretVersion"
874
+ }];
875
+
876
+ // Environment variable name to associate with the secret.
877
+ // Secret environment variables must be unique across all of a build's
878
+ // secrets, and must be used by at least one build step.
879
+ string env = 2 ;
880
+ }
881
+
809
882
// Pairs a set of secret environment variables containing encrypted
810
883
// values with the Cloud KMS key to use to decrypt the value.
884
+ // Note: Use `kmsKeyName` with `available_secrets` instead of using
885
+ // `kmsKeyName` with `secret`. For instructions see:
886
+ // https://cloud.google.com/cloud-build/docs/securing-builds/use-encrypted-credentials.
811
887
message Secret {
812
888
// Cloud KMS key name to use to decrypt these envs.
813
889
string kms_key_name = 1 ;
@@ -865,7 +941,15 @@ message ListBuildsRequest {
865
941
// Number of results to return in the list.
866
942
int32 page_size = 2 ;
867
943
868
- // Token to provide to skip to a particular spot in the list.
944
+ // The page token for the next page of Builds.
945
+ //
946
+ // If unspecified, the first page of results is returned.
947
+ //
948
+ // If the token is rejected for any reason, INVALID_ARGUMENT will be thrown.
949
+ // In this case, the token should be discarded, and pagination should be
950
+ // restarted from the first page of results.
951
+ //
952
+ // See https://google.aip.dev/158 for more.
869
953
string page_token = 3 ;
870
954
871
955
// The raw filter text to constrain the results.
@@ -878,12 +962,13 @@ message ListBuildsResponse {
878
962
repeated Build builds = 1 ;
879
963
880
964
// Token to receive the next page of results.
965
+ // This will be absent if the end of the response list has been reached.
881
966
string next_page_token = 2 ;
882
967
}
883
968
884
969
// Request to cancel an ongoing build.
885
970
message CancelBuildRequest {
886
- // The name of the `Build` to retrieve .
971
+ // The name of the `Build` to cancel .
887
972
// Format: `projects/{project}/locations/{location}/builds/{build}`
888
973
string name = 4 [(google.api.resource_reference ) = {
889
974
type : "cloudbuild.googleapis.com/Build"
@@ -941,8 +1026,8 @@ message BuildTrigger {
941
1026
// Contents of the build template.
942
1027
Build build = 4 ;
943
1028
944
- // Path, from the source root, to a file whose contents is used for the
945
- // template .
1029
+ // Path, from the source root, to the build configuration file
1030
+ // (i.e. cloudbuild.yaml) .
946
1031
string filename = 8 ;
947
1032
}
948
1033
@@ -1018,6 +1103,10 @@ message PullRequestFilter {
1018
1103
// Enforce that repository owners or collaborators must comment on Pull
1019
1104
// Requests before builds are triggered.
1020
1105
COMMENTS_ENABLED = 1 ;
1106
+
1107
+ // Enforce that repository owners or collaborators must comment on external
1108
+ // contributors' Pull Requests before builds are triggered.
1109
+ COMMENTS_ENABLED_FOR_EXTERNAL_CONTRIBUTORS_ONLY = 2 ;
1021
1110
}
1022
1111
1023
1112
// Target refs to match.
@@ -1144,6 +1233,12 @@ message BuildOptions {
1144
1233
1145
1234
// Highcpu machine with 32 CPUs.
1146
1235
N1_HIGHCPU_32 = 2 ;
1236
+
1237
+ // Highcpu e2 machine with 8 CPUs.
1238
+ E2_HIGHCPU_8 = 5 ;
1239
+
1240
+ // Highcpu e2 machine with 32 CPUs.
1241
+ E2_HIGHCPU_32 = 6 ;
1147
1242
}
1148
1243
1149
1244
// Specifies the behavior when there is an error in the substitution checks.
@@ -1190,7 +1285,6 @@ message BuildOptions {
1190
1285
CLOUD_LOGGING_ONLY = 5 ;
1191
1286
1192
1287
// Turn off all logging. No build logs will be captured.
1193
- // Next ID: 6
1194
1288
NONE = 4 ;
1195
1289
}
1196
1290
@@ -1265,6 +1359,26 @@ message BuildOptions {
1265
1359
repeated Volume volumes = 14 ;
1266
1360
}
1267
1361
1362
+ // ReceiveTriggerWebhookRequest [Experimental] is the request object accepted by
1363
+ // the ReceiveTriggerWebhook method.
1364
+ message ReceiveTriggerWebhookRequest {
1365
+ // HTTP request body.
1366
+ google.api.HttpBody body = 1 ;
1367
+
1368
+ // Project in which the specified trigger lives
1369
+ string project_id = 2 ;
1370
+
1371
+ // Name of the trigger to run the payload against
1372
+ string trigger = 3 ;
1373
+
1374
+ // Secret token used for authorization if an OAuth token isn't provided.
1375
+ string secret = 4 ;
1376
+ }
1377
+
1378
+ // ReceiveTriggerWebhookResponse [Experimental] is the response object for the
1379
+ // ReceiveTriggerWebhook method.
1380
+ message ReceiveTriggerWebhookResponse {}
1381
+
1268
1382
// Configuration for a WorkerPool to run the builds.
1269
1383
//
1270
1384
// Workers are machines that Cloud Build uses to run your builds. By default,
0 commit comments