Skip to content

Commit

Permalink
feat!: Updated third_party Cloud Build clients with new Build message…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
Google APIs authored and copybara-github committed Sep 10, 2020
1 parent 3257ba5 commit bc18612
Show file tree
Hide file tree
Showing 3 changed files with 149 additions and 23 deletions.
2 changes: 2 additions & 0 deletions google/devtools/cloudbuild/v1/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
],
)
Expand Down
137 changes: 121 additions & 16 deletions google/devtools/cloudbuild/v1/cloudbuild.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,26 @@ 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";
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.
//
Expand All @@ -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) = {
Expand All @@ -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";
}
Expand All @@ -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";
}
Expand All @@ -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";
}
Expand Down Expand Up @@ -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) = {
Expand Down Expand Up @@ -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];

Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -532,17 +568,22 @@ 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];

// Output only. ID of the project.
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;
Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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];

Expand All @@ -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];

Expand All @@ -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];

Expand All @@ -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];

Expand All @@ -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];

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand All @@ -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;
Expand All @@ -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
Expand Down
Loading

0 comments on commit bc18612

Please sign in to comment.