Skip to content
Permalink
Browse files
feat: Update cloudbuild proto with the service_account for BYOSA Trig…
…gers. (#599)

* feat: Update cloudbuild proto with the service_account for BYOSA Triggers.

Committer: @emoryruscus
PiperOrigin-RevId: 392957767

Source-Link: googleapis/googleapis@5572865

Source-Link: googleapis/googleapis-gen@bc40f42

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: kelsk <38271546+kelsk@users.noreply.github.com>
  • Loading branch information
3 people committed Sep 3, 2021
1 parent 298f04f commit f4e035a77408da6f0cc4d058b6dd346ba8d457bb
Show file tree
Hide file tree
Showing 5 changed files with 253 additions and 0 deletions.
@@ -565,6 +565,7 @@ public void createBuildTriggerTest() throws Exception {
.addAllIgnoredFiles(new ArrayList<String>())
.addAllIncludedFiles(new ArrayList<String>())
.setFilter("filter-1274492040")
.setServiceAccount("serviceAccount1079137720")
.build();
mockCloudBuild.addResponse(expectedResponse);

@@ -620,6 +621,7 @@ public void getBuildTriggerTest() throws Exception {
.addAllIgnoredFiles(new ArrayList<String>())
.addAllIncludedFiles(new ArrayList<String>())
.setFilter("filter-1274492040")
.setServiceAccount("serviceAccount1079137720")
.build();
mockCloudBuild.addResponse(expectedResponse);

@@ -756,6 +758,7 @@ public void updateBuildTriggerTest() throws Exception {
.addAllIgnoredFiles(new ArrayList<String>())
.addAllIncludedFiles(new ArrayList<String>())
.setFilter("filter-1274492040")
.setServiceAccount("serviceAccount1079137720")
.build();
mockCloudBuild.addResponse(expectedResponse);

@@ -47,6 +47,7 @@ private BuildTrigger() {
ignoredFiles_ = com.google.protobuf.LazyStringArrayList.EMPTY;
includedFiles_ = com.google.protobuf.LazyStringArrayList.EMPTY;
filter_ = "";
serviceAccount_ = "";
}

@java.lang.Override
@@ -264,6 +265,13 @@ private BuildTrigger(
webhookConfig_ = subBuilder.buildPartial();
}

break;
}
case 266:
{
java.lang.String s = input.readStringRequireUtf8();

serviceAccount_ = s;
break;
}
case 274:
@@ -1424,6 +1432,63 @@ public com.google.protobuf.ByteString getFilterBytes() {
}
}

public static final int SERVICE_ACCOUNT_FIELD_NUMBER = 33;
private volatile java.lang.Object serviceAccount_;
/**
*
*
* <pre>
* The service account used for all user-controlled operations including
* UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild.
* If no service account is set, then the standard Cloud Build service account
* ([PROJECT_NUM]&#64;system.gserviceaccount.com) will be used instead.
* Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`
* </pre>
*
* <code>string service_account = 33 [(.google.api.resource_reference) = { ... }</code>
*
* @return The serviceAccount.
*/
@java.lang.Override
public java.lang.String getServiceAccount() {
java.lang.Object ref = serviceAccount_;
if (ref instanceof java.lang.String) {
return (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
serviceAccount_ = s;
return s;
}
}
/**
*
*
* <pre>
* The service account used for all user-controlled operations including
* UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild.
* If no service account is set, then the standard Cloud Build service account
* ([PROJECT_NUM]&#64;system.gserviceaccount.com) will be used instead.
* Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`
* </pre>
*
* <code>string service_account = 33 [(.google.api.resource_reference) = { ... }</code>
*
* @return The bytes for serviceAccount.
*/
@java.lang.Override
public com.google.protobuf.ByteString getServiceAccountBytes() {
java.lang.Object ref = serviceAccount_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
serviceAccount_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}

private byte memoizedIsInitialized = -1;

@java.lang.Override
@@ -1488,6 +1553,9 @@ public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io
if (webhookConfig_ != null) {
output.writeMessage(31, getWebhookConfig());
}
if (!getServiceAccountBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 33, serviceAccount_);
}
if (!getResourceNameBytes().isEmpty()) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 34, resourceName_);
}
@@ -1577,6 +1645,9 @@ public int getSerializedSize() {
if (webhookConfig_ != null) {
size += com.google.protobuf.CodedOutputStream.computeMessageSize(31, getWebhookConfig());
}
if (!getServiceAccountBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(33, serviceAccount_);
}
if (!getResourceNameBytes().isEmpty()) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(34, resourceName_);
}
@@ -1625,6 +1696,7 @@ public boolean equals(final java.lang.Object obj) {
if (!getIgnoredFilesList().equals(other.getIgnoredFilesList())) return false;
if (!getIncludedFilesList().equals(other.getIncludedFilesList())) return false;
if (!getFilter().equals(other.getFilter())) return false;
if (!getServiceAccount().equals(other.getServiceAccount())) return false;
if (!getBuildTemplateCase().equals(other.getBuildTemplateCase())) return false;
switch (buildTemplateCase_) {
case 18:
@@ -1698,6 +1770,8 @@ public int hashCode() {
}
hash = (37 * hash) + FILTER_FIELD_NUMBER;
hash = (53 * hash) + getFilter().hashCode();
hash = (37 * hash) + SERVICE_ACCOUNT_FIELD_NUMBER;
hash = (53 * hash) + getServiceAccount().hashCode();
switch (buildTemplateCase_) {
case 18:
hash = (37 * hash) + AUTODETECT_FIELD_NUMBER;
@@ -1928,6 +2002,8 @@ public Builder clear() {
bitField0_ = (bitField0_ & ~0x00000008);
filter_ = "";

serviceAccount_ = "";

buildTemplateCase_ = 0;
buildTemplate_ = null;
return this;
@@ -2019,6 +2095,7 @@ public com.google.cloudbuild.v1.BuildTrigger buildPartial() {
}
result.includedFiles_ = includedFiles_;
result.filter_ = filter_;
result.serviceAccount_ = serviceAccount_;
result.buildTemplateCase_ = buildTemplateCase_;
onBuilt();
return result;
@@ -2138,6 +2215,10 @@ public Builder mergeFrom(com.google.cloudbuild.v1.BuildTrigger other) {
filter_ = other.filter_;
onChanged();
}
if (!other.getServiceAccount().isEmpty()) {
serviceAccount_ = other.serviceAccount_;
onChanged();
}
switch (other.getBuildTemplateCase()) {
case AUTODETECT:
{
@@ -5050,6 +5131,132 @@ public Builder setFilterBytes(com.google.protobuf.ByteString value) {
return this;
}

private java.lang.Object serviceAccount_ = "";
/**
*
*
* <pre>
* The service account used for all user-controlled operations including
* UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild.
* If no service account is set, then the standard Cloud Build service account
* ([PROJECT_NUM]&#64;system.gserviceaccount.com) will be used instead.
* Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`
* </pre>
*
* <code>string service_account = 33 [(.google.api.resource_reference) = { ... }</code>
*
* @return The serviceAccount.
*/
public java.lang.String getServiceAccount() {
java.lang.Object ref = serviceAccount_;
if (!(ref instanceof java.lang.String)) {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
serviceAccount_ = s;
return s;
} else {
return (java.lang.String) ref;
}
}
/**
*
*
* <pre>
* The service account used for all user-controlled operations including
* UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild.
* If no service account is set, then the standard Cloud Build service account
* ([PROJECT_NUM]&#64;system.gserviceaccount.com) will be used instead.
* Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`
* </pre>
*
* <code>string service_account = 33 [(.google.api.resource_reference) = { ... }</code>
*
* @return The bytes for serviceAccount.
*/
public com.google.protobuf.ByteString getServiceAccountBytes() {
java.lang.Object ref = serviceAccount_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref);
serviceAccount_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
/**
*
*
* <pre>
* The service account used for all user-controlled operations including
* UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild.
* If no service account is set, then the standard Cloud Build service account
* ([PROJECT_NUM]&#64;system.gserviceaccount.com) will be used instead.
* Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`
* </pre>
*
* <code>string service_account = 33 [(.google.api.resource_reference) = { ... }</code>
*
* @param value The serviceAccount to set.
* @return This builder for chaining.
*/
public Builder setServiceAccount(java.lang.String value) {
if (value == null) {
throw new NullPointerException();
}

serviceAccount_ = value;
onChanged();
return this;
}
/**
*
*
* <pre>
* The service account used for all user-controlled operations including
* UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild.
* If no service account is set, then the standard Cloud Build service account
* ([PROJECT_NUM]&#64;system.gserviceaccount.com) will be used instead.
* Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`
* </pre>
*
* <code>string service_account = 33 [(.google.api.resource_reference) = { ... }</code>
*
* @return This builder for chaining.
*/
public Builder clearServiceAccount() {

serviceAccount_ = getDefaultInstance().getServiceAccount();
onChanged();
return this;
}
/**
*
*
* <pre>
* The service account used for all user-controlled operations including
* UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild.
* If no service account is set, then the standard Cloud Build service account
* ([PROJECT_NUM]&#64;system.gserviceaccount.com) will be used instead.
* Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`
* </pre>
*
* <code>string service_account = 33 [(.google.api.resource_reference) = { ... }</code>
*
* @param value The bytes for serviceAccount to set.
* @return This builder for chaining.
*/
public Builder setServiceAccountBytes(com.google.protobuf.ByteString value) {
if (value == null) {
throw new NullPointerException();
}
checkByteStringIsUtf8(value);

serviceAccount_ = value;
onChanged();
return this;
}

@java.lang.Override
public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) {
return super.setUnknownFields(unknownFields);
@@ -747,5 +747,38 @@
*/
com.google.protobuf.ByteString getFilterBytes();

/**
*
*
* <pre>
* The service account used for all user-controlled operations including
* UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild.
* If no service account is set, then the standard Cloud Build service account
* ([PROJECT_NUM]&#64;system.gserviceaccount.com) will be used instead.
* Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`
* </pre>
*
* <code>string service_account = 33 [(.google.api.resource_reference) = { ... }</code>
*
* @return The serviceAccount.
*/
java.lang.String getServiceAccount();
/**
*
*
* <pre>
* The service account used for all user-controlled operations including
* UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild.
* If no service account is set, then the standard Cloud Build service account
* ([PROJECT_NUM]&#64;system.gserviceaccount.com) will be used instead.
* Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`
* </pre>
*
* <code>string service_account = 33 [(.google.api.resource_reference) = { ... }</code>
*
* @return The bytes for serviceAccount.
*/
com.google.protobuf.ByteString getServiceAccountBytes();

public com.google.cloudbuild.v1.BuildTrigger.BuildTemplateCase getBuildTemplateCase();
}
@@ -1249,6 +1249,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
"IgnoredFiles",
"IncludedFiles",
"Filter",
"ServiceAccount",
"BuildTemplate",
});
internal_static_google_devtools_cloudbuild_v1_BuildTrigger_SubstitutionsEntry_descriptor =
@@ -1377,6 +1377,15 @@ message BuildTrigger {

// Optional. A Common Expression Language string.
string filter = 30 [(google.api.field_behavior) = OPTIONAL];

// The service account used for all user-controlled operations including
// UpdateBuildTrigger, RunBuildTrigger, CreateBuild, and CancelBuild.
// If no service account is set, then the standard Cloud Build service account
// ([PROJECT_NUM]@system.gserviceaccount.com) will be used instead.
// Format: `projects/{PROJECT_ID}/serviceAccounts/{ACCOUNT_ID_OR_EMAIL}`
string service_account = 33 [(google.api.resource_reference) = {
type: "iam.googleapis.com/ServiceAccount"
}];
}

// GitHubEventsConfig describes the configuration of a trigger that creates a

0 comments on commit f4e035a

Please sign in to comment.