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

- `service_account`, which is available to members of our closed alpha
- STACKDRIVER_ONLY and CLOUD_LOGGING_ONLY logging modes
- `dynamic_substitutions` option

BREAKING CHANGE: The WorkerPool API in the v1 surface has been long deprecated, so it has been deleted from the v1 surface. Alpha WorkerPool customers who want to call the WorkerPool API can use gcloud.

PiperOrigin-RevId: 330504082
This commit is contained in:
Google APIs 2020-09-08 07:21:07 -07:00 committed by Copybara-Service
parent a8c73212a7
commit 48ce8878cd
3 changed files with 84 additions and 230 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";
@ -197,33 +199,6 @@ service CloudBuild {
metadata_type: "BuildOperationMetadata"
};
}
// Creates a `WorkerPool` to run the builds, and returns the new worker pool.
//
// This API is experimental.
rpc CreateWorkerPool(CreateWorkerPoolRequest) returns (WorkerPool) {}
// Returns information about a `WorkerPool`.
//
// This API is experimental.
rpc GetWorkerPool(GetWorkerPoolRequest) returns (WorkerPool) {}
// Deletes a `WorkerPool` by its project ID and WorkerPool name.
//
// This API is experimental.
rpc DeleteWorkerPool(DeleteWorkerPoolRequest)
returns (google.protobuf.Empty) {}
// Update a `WorkerPool`.
//
// This API is experimental.
rpc UpdateWorkerPool(UpdateWorkerPoolRequest) returns (WorkerPool) {}
// List project's `WorkerPools`.
//
// This API is experimental.
rpc ListWorkerPools(ListWorkerPoolsRequest)
returns (ListWorkerPoolsResponse) {}
}
// Specifies a build to retry.
@ -416,7 +391,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 +401,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 +477,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.
@ -539,10 +520,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 +553,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 +588,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 +620,13 @@ 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;
}
// Artifacts produced by a build that should be uploaded upon
@ -656,7 +647,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
@ -821,6 +812,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,7 +863,7 @@ 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
@ -948,8 +944,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 +1046,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 +1089,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 +1127,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 +1149,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
@ -1158,184 +1178,3 @@ message BuildOptions {
// it is indicative of a build request with an incorrect configuration.
repeated Volume volumes = 14;
}
// Configuration for a WorkerPool to run the builds.
//
// Workers are machines that Cloud Build uses to run your builds. By default,
// all workers run in a project owned by Cloud Build. To have full control over
// the workers that execute your builds -- such as enabling them to access
// private resources on your private network -- you can request Cloud Build to
// run the workers in your own project by creating a custom workers pool.
message WorkerPool {
// Supported GCP regions to create the `WorkerPool`.
enum Region {
// no region
REGION_UNSPECIFIED = 0;
// us-central1 region
US_CENTRAL1 = 1;
// us-west1 region
US_WEST1 = 2;
// us-east1 region
US_EAST1 = 3;
// us-east4 region
US_EAST4 = 4;
}
// `WorkerPool` status
enum Status {
// Status of the `WorkerPool` is unknown.
STATUS_UNSPECIFIED = 0;
// `WorkerPool` is being created.
CREATING = 1;
// `WorkerPool` is running.
RUNNING = 2;
// `WorkerPool` is being deleted: cancelling builds and draining workers.
DELETING = 3;
// `WorkerPool` is deleted.
DELETED = 4;
}
// User-defined name of the `WorkerPool`.
string name = 14;
// The project ID of the GCP project for which the `WorkerPool` is created.
string project_id = 2;
// Output only. The service account used to manage the `WorkerPool`. The
// service account must have the Compute Instance Admin (Beta) permission at
// the project level.
string service_account_email = 3;
// Total number of workers to be created across all requested regions.
int64 worker_count = 4;
// Configuration to be used for a creating workers in the `WorkerPool`.
WorkerConfig worker_config = 16;
// List of regions to create the `WorkerPool`. Regions can't be empty.
// If Cloud Build adds a new GCP region in the future, the existing
// `WorkerPool` will not be enabled in the new region automatically;
// you must add the new region to the `regions` field to enable the
// `WorkerPool` in that region.
repeated Region regions = 9;
// Output only. Time at which the request to create the `WorkerPool` was
// received.
google.protobuf.Timestamp create_time = 11;
// Output only. Time at which the request to update the `WorkerPool` was
// received.
google.protobuf.Timestamp update_time = 17;
// Output only. Time at which the request to delete the `WorkerPool` was
// received.
google.protobuf.Timestamp delete_time = 12;
// Output only. WorkerPool Status.
Status status = 13;
}
// WorkerConfig defines the configuration to be used for a creating workers in
// the pool.
message WorkerConfig {
// Machine Type of the worker, such as n1-standard-1.
// See https://cloud.google.com/compute/docs/machine-types.
// If left blank, Cloud Build will use a standard unspecified machine to
// create the worker pool.
// `machine_type` is overridden if you specify a different machine type in
// `build_options`. In this case, the VM specified in the `build_options`
// will be created on demand at build time. For more information see
// https://cloud.google.com/cloud-build/docs/speeding-up-builds#using_custom_virtual_machine_sizes
string machine_type = 1;
// Size of the disk attached to the worker, in GB.
// See https://cloud.google.com/compute/docs/disks/
// If `0` is specified, Cloud Build will use a standard disk size.
// `disk_size` is overridden if you specify a different disk size in
// `build_options`. In this case, a VM with a disk size specified in the
// `build_options` will be created on demand at build time. For more
// information see
// https://cloud.google.com/cloud-build/docs/api/reference/rest/v1/projects.builds#buildoptions
int64 disk_size_gb = 2;
// The network definition used to create the worker.
// If this section is left empty, the workers will be created in
// WorkerPool.project_id on the default network.
Network network = 3;
// The tag applied to the worker, and the same tag used by the firewall rule.
// It is used to identify the Cloud Build workers among other VMs.
// The default value for tag is `worker`.
string tag = 4;
}
// Network describes the GCP network used to create workers in.
message Network {
// Project id containing the defined network and subnetwork. For a peered VPC,
// this will be the same as the project_id in which the workers are created.
// For a shared VPC, this will be the project sharing the network with the
// project_id project in which workers will be created. For custom workers
// with no VPC, this will be the same as project_id.
string project_id = 1;
// Network on which the workers are created.
// "default" network is used if empty.
string network = 2;
// Subnetwork on which the workers are created.
// "default" subnetwork is used if empty.
string subnetwork = 3;
}
// Request to create a new `WorkerPool`.
message CreateWorkerPoolRequest {
// ID of the parent project.
string parent = 1;
// `WorkerPool` resource to create.
WorkerPool worker_pool = 2;
}
// Request to get a `WorkerPool` with the specified name.
message GetWorkerPoolRequest {
// The field will contain name of the resource requested, for example:
// "projects/project-1/workerPools/workerpool-name"
string name = 1;
}
// Request to delete a `WorkerPool`.
message DeleteWorkerPoolRequest {
// The field will contain name of the resource requested, for example:
// "projects/project-1/workerPools/workerpool-name"
string name = 1;
}
// Request to update a `WorkerPool`.
message UpdateWorkerPoolRequest {
// The field will contain name of the resource requested, for example:
// "projects/project-1/workerPools/workerpool-name"
string name = 2;
// `WorkerPool` resource to update.
WorkerPool worker_pool = 3;
}
// Request to list `WorkerPools`.
message ListWorkerPoolsRequest {
// ID of the parent project.
string parent = 1;
}
// Response containing existing `WorkerPools`.
message ListWorkerPoolsResponse {
// `WorkerPools` for the project.
repeated WorkerPool worker_pools = 1;
}

View File

@ -27,20 +27,29 @@ 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.devtools.cloudbuild.v1.CloudBuild.UpdateWorkerPool
deadline: 20.0
- selector: 'google.longrunning.Operations.*'
- selector: google.longrunning.Operations.CancelOperation
deadline: 5.0
- selector: google.longrunning.Operations.GetOperation
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 +57,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