feat!: Updated third_party Cloud Build clients with new Build message fields:

- `service_account`, which is available to members of our closed alpha
- CLOUD_LOGGING_ONLY logging modes
- `dynamic_substitutions` option
- resource annotations added

PiperOrigin-RevId: 331027363
This commit is contained in:
Google APIs 2020-09-10 15:15:28 -07:00 committed by Copybara-Service
parent 3257ba5216
commit bc18612d35
3 changed files with 149 additions and 23 deletions

View File

@ -18,9 +18,11 @@ proto_library(
"//google/api:annotations_proto",
"//google/api:client_proto",
"//google/api:field_behavior_proto",
"//google/api:resource_proto",
"//google/longrunning:operations_proto",
"@com_google_protobuf//:duration_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:field_mask_proto",
"@com_google_protobuf//:timestamp_proto",
],
)

View File

@ -19,9 +19,11 @@ package google.devtools.cloudbuild.v1;
import "google/api/annotations.proto";
import "google/api/client.proto";
import "google/api/field_behavior.proto";
import "google/api/resource.proto";
import "google/longrunning/operations.proto";
import "google/protobuf/duration.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
option go_package = "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1;cloudbuild";
@ -29,6 +31,14 @@ option java_multiple_files = true;
option java_package = "com.google.cloudbuild.v1";
option objc_class_prefix = "GCB";
option ruby_package = "Google::Cloud::Build::V1";
option (google.api.resource_definition) = {
type: "compute.googleapis.com/Network"
pattern: "projects/{project}/global/networks/{network}"
};
option (google.api.resource_definition) = {
type: "iam.googleapis.com/ServiceAccount"
pattern: "projects/{project}/serviceAccounts/{service_account}"
};
// Creates and manages builds on Google Cloud Platform.
//
@ -52,6 +62,10 @@ service CloudBuild {
option (google.api.http) = {
post: "/v1/projects/{project_id}/builds"
body: "build"
additional_bindings {
post: "/v1/{parent=projects/*/locations/*}/builds"
body: "*"
}
};
option (google.api.method_signature) = "project_id,build";
option (google.longrunning.operation_info) = {
@ -67,6 +81,7 @@ service CloudBuild {
rpc GetBuild(GetBuildRequest) returns (Build) {
option (google.api.http) = {
get: "/v1/projects/{project_id}/builds/{id}"
additional_bindings { get: "/v1/{name=projects/*/locations/*/builds/*}" }
};
option (google.api.method_signature) = "project_id,id";
}
@ -78,6 +93,7 @@ service CloudBuild {
rpc ListBuilds(ListBuildsRequest) returns (ListBuildsResponse) {
option (google.api.http) = {
get: "/v1/projects/{project_id}/builds"
additional_bindings { get: "/v1/{parent=projects/*/locations/*}/builds" }
};
option (google.api.method_signature) = "project_id,filter";
}
@ -87,6 +103,10 @@ service CloudBuild {
option (google.api.http) = {
post: "/v1/projects/{project_id}/builds/{id}:cancel"
body: "*"
additional_bindings {
post: "/v1/{name=projects/*/locations/*/builds/*}:cancel"
body: "*"
}
};
option (google.api.method_signature) = "project_id,id";
}
@ -122,6 +142,10 @@ service CloudBuild {
option (google.api.http) = {
post: "/v1/projects/{project_id}/builds/{id}:retry"
body: "*"
additional_bindings {
post: "/v1/{name=projects/*/locations/*/builds/*}:retry"
body: "*"
}
};
option (google.api.method_signature) = "project_id,id";
option (google.longrunning.operation_info) = {
@ -228,6 +252,12 @@ service CloudBuild {
// Specifies a build to retry.
message RetryBuildRequest {
// The name of the `Build` to retry.
// Format: `projects/{project}/locations/{location}/builds/{build}`
string name = 3 [(google.api.resource_reference) = {
type: "cloudbuild.googleapis.com/Build"
}];
// Required. ID of the project.
string project_id = 1 [(google.api.field_behavior) = REQUIRED];
@ -416,7 +446,7 @@ message BuildStep {
// Output only. Stores timing information for pulling this build step's
// builder image only.
TimeSpan pull_timing = 13;
TimeSpan pull_timing = 13 [(google.api.field_behavior) = OUTPUT_ONLY];
// Time limit for executing this build step. If not defined, the step has no
// time limit and will be allowed to continue to run until either it completes
@ -426,7 +456,7 @@ message BuildStep {
// Output only. Status of the build step. At this time, build step status is
// only updated on build completion; step status is not updated in real-time
// as the build progresses.
Build.Status status = 12;
Build.Status status = 12 [(google.api.field_behavior) = OUTPUT_ONLY];
}
// Volume describes a Docker container volume which is mounted into build steps
@ -502,6 +532,12 @@ message ArtifactResult {
// resolved from the specified branch or tag.
// - $SHORT_SHA: first 7 characters of $REVISION_ID or $COMMIT_SHA.
message Build {
option (google.api.resource) = {
type: "cloudbuild.googleapis.com/Build"
pattern: "projects/{project}/builds/{build}"
pattern: "projects/{project}/locations/{location}/builds/{build}"
};
// Possible status of a build or build step.
enum Status {
// Status of the build is unknown.
@ -532,6 +568,11 @@ message Build {
EXPIRED = 9;
}
// Output only. The 'Build' name with format:
// `projects/{project}/locations/{location}/builds/{build}`, where {build}
// is a unique identifier generated by the service.
string name = 45 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. Unique identifier of the build.
string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
@ -539,10 +580,10 @@ message Build {
string project_id = 16 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. Status of the build.
Status status = 2;
Status status = 2 [(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. Customer-readable message about the current status.
string status_detail = 24;
string status_detail = 24 [(google.api.field_behavior) = OUTPUT_ONLY];
// The location of the source files to build.
Source source = 3;
@ -572,6 +613,8 @@ message Build {
// granularity. If this amount of time elapses, work on the build will cease
// and the build status will be `TIMEOUT`.
//
// `timeout` starts ticking from `startTime`.
//
// Default time is ten minutes.
google.protobuf.Duration timeout = 12;
@ -605,11 +648,12 @@ message Build {
string logs_bucket = 19;
// Output only. A permanent fixed identifier for source.
SourceProvenance source_provenance = 21;
SourceProvenance source_provenance = 21
[(google.api.field_behavior) = OUTPUT_ONLY];
// Output only. The ID of the `BuildTrigger` that triggered this build, if it
// was triggered automatically.
string build_trigger_id = 22;
string build_trigger_id = 22 [(google.api.field_behavior) = OUTPUT_ONLY];
// Special options for this build.
BuildOptions options = 23;
@ -636,6 +680,15 @@ message Build {
// If the build does not specify source or images,
// these keys will not be included.
map<string, TimeSpan> timing = 33 [(google.api.field_behavior) = OUTPUT_ONLY];
// IAM service account whose credentials will be used at build runtime.
// Must be of the format `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT}`.
// ACCOUNT can be email address or uniqueId of the service account.
//
// This field is in alpha and is not publicly available.
string service_account = 42 [(google.api.resource_reference) = {
type: "iam.googleapis.com/ServiceAccount"
}];
}
// Artifacts produced by a build that should be uploaded upon
@ -656,7 +709,7 @@ message Artifacts {
repeated string paths = 2;
// Output only. Stores timing information for pushing all artifact objects.
TimeSpan timing = 3;
TimeSpan timing = 3 [(google.api.field_behavior) = OUTPUT_ONLY];
}
// A list of images to be pushed upon the successful completion of all build
@ -769,6 +822,12 @@ message Secret {
// Request to create a new build.
message CreateBuildRequest {
// The parent resource where this build will be created.
// Format: `projects/{project}/locations/{location}`
string parent = 4 [(google.api.resource_reference) = {
child_type: "cloudbuild.googleapis.com/Build"
}];
// Required. ID of the project.
string project_id = 1 [(google.api.field_behavior) = REQUIRED];
@ -778,6 +837,12 @@ message CreateBuildRequest {
// Request to get a build.
message GetBuildRequest {
// The name of the `Build` to retrieve.
// Format: `projects/{project}/locations/{location}/builds/{build}`
string name = 4 [(google.api.resource_reference) = {
type: "cloudbuild.googleapis.com/Build"
}];
// Required. ID of the project.
string project_id = 1 [(google.api.field_behavior) = REQUIRED];
@ -787,6 +852,12 @@ message GetBuildRequest {
// Request to list builds.
message ListBuildsRequest {
// The parent of the collection of `Builds`.
// Format: `projects/{project}/locations/location`
string parent = 9 [(google.api.resource_reference) = {
child_type: "cloudbuild.googleapis.com/Build"
}];
// Required. ID of the project.
string project_id = 1 [(google.api.field_behavior) = REQUIRED];
@ -811,6 +882,12 @@ message ListBuildsResponse {
// Request to cancel an ongoing build.
message CancelBuildRequest {
// The name of the `Build` to retrieve.
// Format: `projects/{project}/locations/{location}/builds/{build}`
string name = 4 [(google.api.resource_reference) = {
type: "cloudbuild.googleapis.com/Build"
}];
// Required. ID of the project.
string project_id = 1 [(google.api.field_behavior) = REQUIRED];
@ -821,6 +898,11 @@ message CancelBuildRequest {
// Configuration for an automated build in response to source repository
// changes.
message BuildTrigger {
option (google.api.resource) = {
type: "cloudbuild.googleapis.com/BuildTrigger"
pattern: "projects/{project}/triggers/{trigger}"
};
// Output only. Unique identifier of the trigger.
string id = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
@ -867,12 +949,11 @@ message BuildTrigger {
google.protobuf.Timestamp create_time = 5
[(google.api.field_behavior) = OUTPUT_ONLY];
// If true, the trigger will never result in a build.
// If true, the trigger will never automatically execute a build.
bool disabled = 9;
// Substitutions for Build resource. The keys must match the following
// regular expression: `^_[A-Z0-9_]+$`.The keys cannot conflict with the
// keys in bindings.
// regular expression: `^_[A-Z0-9_]+$`.
map<string, string> substitutions = 11;
// ignored_files and included_files are file glob matches using
@ -948,8 +1029,8 @@ message PullRequestFilter {
string branch = 2;
}
// Whether to block builds on a "/gcbrun" comment from a repository admin or
// collaborator.
// Configure builds to run whether a repository owner or collaborator need to
// comment `/gcbrun`.
CommentControl comment_control = 5;
// If true, branches that do NOT match the git_ref will trigger a build.
@ -1050,7 +1131,9 @@ message BuildOptions {
VERIFIED = 1;
}
// Supported VM sizes.
// Supported Compute Engine machine types.
// For more information, see [Machine
// types](https://cloud.google.com/compute/docs/machine-types).
enum MachineType {
// Standard machine type.
UNSPECIFIED = 0;
@ -1091,11 +1174,23 @@ message BuildOptions {
// rely on the default logging behavior as it may change in the future.
LOGGING_UNSPECIFIED = 0;
// Stackdriver logging and Cloud Storage logging are enabled.
// Cloud Logging and Cloud Storage logging are enabled.
LEGACY = 1;
// Only Cloud Storage logging is enabled.
GCS_ONLY = 2;
// This option is the same as CLOUD_LOGGING_ONLY.
STACKDRIVER_ONLY = 3 [deprecated = true];
// Only Cloud Logging is enabled. Note that logs for both the Cloud Console
// UI and Cloud SDK are based on Cloud Storage logs, so neither will provide
// logs if this option is chosen.
CLOUD_LOGGING_ONLY = 5;
// Turn off all logging. No build logs will be captured.
// Next ID: 6
NONE = 4;
}
// Requested hash for SourceProvenance.
@ -1117,8 +1212,18 @@ message BuildOptions {
// Option to specify behavior when there is an error in the substitution
// checks.
//
// NOTE: this is always set to ALLOW_LOOSE for triggered builds and cannot
// be overridden in the build configuration file.
SubstitutionOption substitution_option = 4;
// Option to specify whether or not to apply bash style string
// operations to the substitutions.
//
// NOTE: this is always enabled for triggered builds and cannot be
// overridden in the build configuration file.
bool dynamic_substitutions = 17;
// Option to define build log streaming behavior to Google Cloud
// Storage.
LogStreamingOption log_streaming_option = 5;
@ -1129,8 +1234,8 @@ message BuildOptions {
// This field is experimental.
string worker_pool = 7;
// Option to specify the logging mode, which determines where the logs are
// stored.
// Option to specify the logging mode, which determines if and where build
// logs are stored.
LoggingMode logging = 11;
// A list of global environment variable definitions that will exist for all

View File

@ -27,20 +27,35 @@ backend:
deadline: 60.0
- selector: google.devtools.cloudbuild.v1.CloudBuild.CreateBuildTrigger
deadline: 60.0
- selector: google.devtools.cloudbuild.v1.CloudBuild.CreateWorkerPool
deadline: 320.0
- selector: google.devtools.cloudbuild.v1.CloudBuild.DeleteWorkerPool
deadline: 320.0
- selector: google.devtools.cloudbuild.v1.CloudBuild.ListBuilds
deadline: 20.0
- selector: google.devtools.cloudbuild.v1.CloudBuild.RetryBuild
deadline: 60.0
- selector: google.devtools.cloudbuild.v1.CloudBuild.RunBuildTrigger
deadline: 180.0
- selector: google.longrunning.Operations.CancelOperation
deadline: 5.0
- selector: google.longrunning.Operations.GetOperation
deadline: 5.0
- selector: google.devtools.cloudbuild.v1.CloudBuild.CreateWorkerPool
deadline: 320.0
- selector: google.devtools.cloudbuild.v1.CloudBuild.DeleteWorkerPool
deadline: 320.0
- selector: google.devtools.cloudbuild.v1.CloudBuild.UpdateWorkerPool
deadline: 20.0
- selector: 'google.longrunning.Operations.*'
deadline: 5.0
http:
rules:
- selector: google.longrunning.Operations.CancelOperation
post: '/v1/{name=operations/**}:cancel'
body: '*'
additional_bindings:
- post: '/v1/{name=projects/*/locations/*/operations/*}:cancel'
body: '*'
- selector: google.longrunning.Operations.GetOperation
get: '/v1/{name=operations/**}'
additional_bindings:
- get: '/v1/{name=projects/*/locations/*/operations/*}'
authentication:
rules:
@ -48,7 +63,11 @@ authentication:
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-platform
- selector: 'google.longrunning.Operations.*'
- selector: google.longrunning.Operations.CancelOperation
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-platform
- selector: google.longrunning.Operations.GetOperation
oauth:
canonical_scopes: |-
https://www.googleapis.com/auth/cloud-platform