From e635c0f5f5007242f8b76de6a150be718a861c5d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 8 Aug 2023 12:29:26 -0400 Subject: [PATCH] feat: add update_mask to UpdateBuildTriggerRequest proto (#421) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Update gapic-generator-python to v1.11.4 PiperOrigin-RevId: 547897126 Source-Link: https://github.com/googleapis/googleapis/commit/c09c75e087d8f9a2d466b4aaad7dd2926b5ead5a Source-Link: https://github.com/googleapis/googleapis-gen/commit/45e0ec4343517cd0aa66b5ca64232a1802c2f945 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDVlMGVjNDM0MzUxN2NkMGFhNjZiNWNhNjQyMzJhMTgwMmMyZjk0NSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: add git_file_source and git_repo_source to build_trigger PiperOrigin-RevId: 550012872 Source-Link: https://github.com/googleapis/googleapis/commit/f90d153e275bb611d3c4948a3434a92593fb4589 Source-Link: https://github.com/googleapis/googleapis-gen/commit/7682e231b6058aa439b4b4f6df236240bf88b3e2 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNzY4MmUyMzFiNjA1OGFhNDM5YjRiNGY2ZGYyMzYyNDBiZjg4YjNlMiJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: Add automap_substitutions flag to use substitutions as envs in Cloud Build PiperOrigin-RevId: 551218480 Source-Link: https://github.com/googleapis/googleapis/commit/f823915dea96078aa7961417f4bb5b4c080bfef3 Source-Link: https://github.com/googleapis/googleapis-gen/commit/5979eecd8d2b0fc158fe7152a4da43ced2929780 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTk3OWVlY2Q4ZDJiMGZjMTU4ZmU3MTUyYTRkYTQzY2VkMjkyOTc4MCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * feat: add update_mask to UpdateBuildTriggerRequest proto PiperOrigin-RevId: 552479161 Source-Link: https://github.com/googleapis/googleapis/commit/f8415bd17221ffa0a4b09424a581b49b25ce46e0 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4ac7667c7dea38738d9e2176305a804de2258be1 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGFjNzY2N2M3ZGVhMzg3MzhkOWUyMTc2MzA1YTgwNGRlMjI1OGJlMSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix docs build. Issue filed upstream here https://github.com/googleapis/gapic-generator-python/issues/1724 --------- Co-authored-by: Owl Bot Co-authored-by: Anthonios Partheniou --- .../cloud/devtools/cloudbuild/__init__.py | 8 + .../cloud/devtools/cloudbuild_v1/__init__.py | 8 + .../services/cloud_build/async_client.py | 6 + .../services/cloud_build/client.py | 19 + .../devtools/cloudbuild_v1/types/__init__.py | 8 + .../cloudbuild_v1/types/cloudbuild.py | 344 +++++++++++++++++- .../cloudbuild_v2/types/repositories.py | 1 + ...etadata_google.devtools.cloudbuild.v1.json | 2 +- ...etadata_google.devtools.cloudbuild.v2.json | 2 +- .../scripts/fixup_cloudbuild_v1_keywords.py | 2 +- .../gapic/cloudbuild_v1/test_cloud_build.py | 195 +++++++--- 11 files changed, 541 insertions(+), 54 deletions(-) diff --git a/packages/google-cloud-build/google/cloud/devtools/cloudbuild/__init__.py b/packages/google-cloud-build/google/cloud/devtools/cloudbuild/__init__.py index 48e8ab57f2a3..badcdb9c7a14 100644 --- a/packages/google-cloud-build/google/cloud/devtools/cloudbuild/__init__.py +++ b/packages/google-cloud-build/google/cloud/devtools/cloudbuild/__init__.py @@ -57,7 +57,11 @@ from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import GetBuildRequest from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import GetBuildTriggerRequest from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import GetWorkerPoolRequest +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import GitFileSource +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import GitHubEnterpriseConfig +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import GitHubEnterpriseSecrets from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import GitHubEventsConfig +from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import GitRepoSource from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import GitSource from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import Hash from google.cloud.devtools.cloudbuild_v1.types.cloudbuild import InlineSecret @@ -135,7 +139,11 @@ "GetBuildRequest", "GetBuildTriggerRequest", "GetWorkerPoolRequest", + "GitFileSource", + "GitHubEnterpriseConfig", + "GitHubEnterpriseSecrets", "GitHubEventsConfig", + "GitRepoSource", "GitSource", "Hash", "InlineSecret", diff --git a/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/__init__.py b/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/__init__.py index 5ed2db4a9f15..07839e4a0817 100644 --- a/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/__init__.py +++ b/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/__init__.py @@ -45,7 +45,11 @@ from .types.cloudbuild import GetBuildRequest from .types.cloudbuild import GetBuildTriggerRequest from .types.cloudbuild import GetWorkerPoolRequest +from .types.cloudbuild import GitFileSource +from .types.cloudbuild import GitHubEnterpriseConfig +from .types.cloudbuild import GitHubEnterpriseSecrets from .types.cloudbuild import GitHubEventsConfig +from .types.cloudbuild import GitRepoSource from .types.cloudbuild import GitSource from .types.cloudbuild import Hash from .types.cloudbuild import InlineSecret @@ -111,7 +115,11 @@ "GetBuildRequest", "GetBuildTriggerRequest", "GetWorkerPoolRequest", + "GitFileSource", + "GitHubEnterpriseConfig", + "GitHubEnterpriseSecrets", "GitHubEventsConfig", + "GitRepoSource", "GitSource", "Hash", "InlineSecret", diff --git a/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py b/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py index 953343d6d66c..9953ec41291b 100644 --- a/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py +++ b/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/services/cloud_build/async_client.py @@ -77,6 +77,12 @@ class CloudBuildAsyncClient: parse_build_trigger_path = staticmethod(CloudBuildClient.parse_build_trigger_path) crypto_key_path = staticmethod(CloudBuildClient.crypto_key_path) parse_crypto_key_path = staticmethod(CloudBuildClient.parse_crypto_key_path) + github_enterprise_config_path = staticmethod( + CloudBuildClient.github_enterprise_config_path + ) + parse_github_enterprise_config_path = staticmethod( + CloudBuildClient.parse_github_enterprise_config_path + ) network_path = staticmethod(CloudBuildClient.network_path) parse_network_path = staticmethod(CloudBuildClient.parse_network_path) repository_path = staticmethod(CloudBuildClient.repository_path) diff --git a/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py b/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py index ad35d7b7d2d3..fb4e90d8ab6b 100644 --- a/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py +++ b/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/services/cloud_build/client.py @@ -246,6 +246,25 @@ def parse_crypto_key_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def github_enterprise_config_path( + project: str, + config: str, + ) -> str: + """Returns a fully-qualified github_enterprise_config string.""" + return "projects/{project}/githubEnterpriseConfigs/{config}".format( + project=project, + config=config, + ) + + @staticmethod + def parse_github_enterprise_config_path(path: str) -> Dict[str, str]: + """Parses a github_enterprise_config path into its component segments.""" + m = re.match( + r"^projects/(?P.+?)/githubEnterpriseConfigs/(?P.+?)$", path + ) + return m.groupdict() if m else {} + @staticmethod def network_path( project: str, diff --git a/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/types/__init__.py b/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/types/__init__.py index 63514f34ff7b..546ce179a36f 100644 --- a/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/types/__init__.py +++ b/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/types/__init__.py @@ -38,7 +38,11 @@ GetBuildRequest, GetBuildTriggerRequest, GetWorkerPoolRequest, + GitFileSource, + GitHubEnterpriseConfig, + GitHubEnterpriseSecrets, GitHubEventsConfig, + GitRepoSource, GitSource, Hash, InlineSecret, @@ -103,7 +107,11 @@ "GetBuildRequest", "GetBuildTriggerRequest", "GetWorkerPoolRequest", + "GitFileSource", + "GitHubEnterpriseConfig", + "GitHubEnterpriseSecrets", "GitHubEventsConfig", + "GitRepoSource", "GitSource", "Hash", "InlineSecret", diff --git a/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py b/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py index d073dba82b93..1b7c699e1702 100644 --- a/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py +++ b/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v1/types/cloudbuild.py @@ -63,6 +63,8 @@ "BuildApproval", "ApprovalConfig", "ApprovalResult", + "GitRepoSource", + "GitFileSource", "BuildTrigger", "RepositoryEventConfig", "GitHubEventsConfig", @@ -79,6 +81,8 @@ "BuildOptions", "ReceiveTriggerWebhookRequest", "ReceiveTriggerWebhookResponse", + "GitHubEnterpriseConfig", + "GitHubEnterpriseSecrets", "WorkerPool", "PrivatePoolV1Config", "CreateWorkerPoolRequest", @@ -534,6 +538,8 @@ class UploadedNpmPackage(proto.Message): class BuildStep(proto.Message): r"""A step in the build pipeline. + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + Attributes: name (str): Required. The name of the container image that will run this @@ -645,6 +651,13 @@ class BuildStep(proto.Message): A shell script to be executed in the step. When script is provided, the user cannot specify the entrypoint or args. + automap_substitutions (bool): + Option to include built-in and custom + substitutions as env variables for this build + step. This option will override the global + option in BuildOption. + + This field is a member of `oneof`_ ``_automap_substitutions``. """ name: str = proto.Field( @@ -720,6 +733,11 @@ class BuildStep(proto.Message): proto.STRING, number=19, ) + automap_substitutions: bool = proto.Field( + proto.BOOL, + number=20, + optional=True, + ) class Volume(proto.Message): @@ -2079,6 +2097,164 @@ class Decision(proto.Enum): ) +class GitRepoSource(proto.Message): + r"""GitRepoSource describes a repo and ref of a code repository. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + uri (str): + The URI of the repo (e.g. https://github.com/user/repo.git). + Either ``uri`` or ``repository`` can be specified and is + required. + repository (str): + The connected repository resource name, in the format + ``projects/*/locations/*/connections/*/repositories/*``. + Either ``uri`` or ``repository`` can be specified and is + required. + + This field is a member of `oneof`_ ``source``. + ref (str): + The branch or tag to use. Must start with + "refs/" (required). + repo_type (google.cloud.devtools.cloudbuild_v1.types.GitFileSource.RepoType): + See RepoType below. + github_enterprise_config (str): + The full resource name of the github enterprise config. + Format: + ``projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}``. + ``projects/{project}/githubEnterpriseConfigs/{id}``. + + This field is a member of `oneof`_ ``enterprise_config``. + """ + + uri: str = proto.Field( + proto.STRING, + number=1, + ) + repository: str = proto.Field( + proto.STRING, + number=6, + oneof="source", + ) + ref: str = proto.Field( + proto.STRING, + number=2, + ) + repo_type: "GitFileSource.RepoType" = proto.Field( + proto.ENUM, + number=3, + enum="GitFileSource.RepoType", + ) + github_enterprise_config: str = proto.Field( + proto.STRING, + number=4, + oneof="enterprise_config", + ) + + +class GitFileSource(proto.Message): + r"""GitFileSource describes a file within a (possibly remote) + code repository. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + path (str): + The path of the file, with the repo root as + the root of the path. + uri (str): + The URI of the repo. + Either uri or repository can be specified. + If unspecified, the repo from which the trigger + invocation originated is assumed to be the repo + from which to read the specified path. + repository (str): + The fully qualified resource name of the + Repos API repository. Either URI or repository + can be specified. If unspecified, the repo from + which the trigger invocation originated is + assumed to be the repo from which to read the + specified path. + + This field is a member of `oneof`_ ``source``. + repo_type (google.cloud.devtools.cloudbuild_v1.types.GitFileSource.RepoType): + See RepoType above. + revision (str): + The branch, tag, arbitrary ref, or SHA + version of the repo to use when resolving the + filename (optional). This field respects the + same syntax/resolution as described here: + + https://git-scm.com/docs/gitrevisions + If unspecified, the revision from which the + trigger invocation originated is assumed to be + the revision from which to read the specified + path. + github_enterprise_config (str): + The full resource name of the github enterprise config. + Format: + ``projects/{project}/locations/{location}/githubEnterpriseConfigs/{id}``. + ``projects/{project}/githubEnterpriseConfigs/{id}``. + + This field is a member of `oneof`_ ``enterprise_config``. + """ + + class RepoType(proto.Enum): + r"""The type of the repo, since it may not be explicit from the ``repo`` + field (e.g from a URL). + + Values: + UNKNOWN (0): + The default, unknown repo type. Don't use it, + instead use one of the other repo types. + CLOUD_SOURCE_REPOSITORIES (1): + A Google Cloud Source Repositories-hosted + repo. + GITHUB (2): + A GitHub-hosted repo not necessarily on + "github.com" (i.e. GitHub Enterprise). + BITBUCKET_SERVER (3): + A Bitbucket Server-hosted repo. + GITLAB (4): + A GitLab-hosted repo. + """ + UNKNOWN = 0 + CLOUD_SOURCE_REPOSITORIES = 1 + GITHUB = 2 + BITBUCKET_SERVER = 3 + GITLAB = 4 + + path: str = proto.Field( + proto.STRING, + number=1, + ) + uri: str = proto.Field( + proto.STRING, + number=2, + ) + repository: str = proto.Field( + proto.STRING, + number=7, + oneof="source", + ) + repo_type: RepoType = proto.Field( + proto.ENUM, + number=3, + enum=RepoType, + ) + revision: str = proto.Field( + proto.STRING, + number=4, + ) + github_enterprise_config: str = proto.Field( + proto.STRING, + number=5, + oneof="enterprise_config", + ) + + class BuildTrigger(proto.Message): r"""Configuration for an automated build in response to source repository changes. @@ -2105,10 +2281,12 @@ class BuildTrigger(proto.Message): User-assigned name of the trigger. Must be unique within the project. Trigger names must meet the following requirements: + + They must contain only alphanumeric characters - and dashes. + They can be 1-64 characters long. + and dashes. + + They can be 1-64 characters long. + They must begin and end with an alphanumeric - character. + character. tags (MutableSequence[str]): Tags for annotation of a ``BuildTrigger`` trigger_template (google.cloud.devtools.cloudbuild_v1.types.RepoSource): @@ -2136,6 +2314,7 @@ class BuildTrigger(proto.Message): autodetect (bool): Autodetect build configuration. The following precedence is used (case insensitive): + 1. cloudbuild.yaml 2. cloudbuild.yml 3. cloudbuild.json @@ -2153,6 +2332,11 @@ class BuildTrigger(proto.Message): Path, from the source root, to the build configuration file (i.e. cloudbuild.yaml). + This field is a member of `oneof`_ ``build_template``. + git_file_source (google.cloud.devtools.cloudbuild_v1.types.GitFileSource): + The file source describing the local or + remote Build template. + This field is a member of `oneof`_ ``build_template``. create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Time when the trigger was @@ -2188,6 +2372,14 @@ class BuildTrigger(proto.Message): filter (str): Optional. A Common Expression Language string. + source_to_build (google.cloud.devtools.cloudbuild_v1.types.GitRepoSource): + The repo and ref of the repository from which + to build. This field is used only for those + triggers that do not respond to SCM events. + Triggers that respond to such events build + source at whatever commit caused the event. + This field is currently only used by Webhook, + Pub/Sub, Manual, and Cron triggers. service_account (str): The service account used for all user-controlled operations including UpdateBuildTrigger, RunBuildTrigger, CreateBuild, @@ -2258,6 +2450,12 @@ class BuildTrigger(proto.Message): number=8, oneof="build_template", ) + git_file_source: "GitFileSource" = proto.Field( + proto.MESSAGE, + number=24, + oneof="build_template", + message="GitFileSource", + ) create_time: timestamp_pb2.Timestamp = proto.Field( proto.MESSAGE, number=5, @@ -2284,6 +2482,11 @@ class BuildTrigger(proto.Message): proto.STRING, number=30, ) + source_to_build: "GitRepoSource" = proto.Field( + proto.MESSAGE, + number=26, + message="GitRepoSource", + ) service_account: str = proto.Field( proto.STRING, number=33, @@ -2806,6 +3009,11 @@ class UpdateBuildTriggerRequest(proto.Message): Required. ID of the ``BuildTrigger`` to update. trigger (google.cloud.devtools.cloudbuild_v1.types.BuildTrigger): Required. ``BuildTrigger`` to update. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Update mask for the resource. If this is set, + the server will only update the fields specified + in the field mask. Otherwise, a full update of + the mutable resource fields will be performed. """ project_id: str = proto.Field( @@ -2821,6 +3029,11 @@ class UpdateBuildTriggerRequest(proto.Message): number=3, message="BuildTrigger", ) + update_mask: field_mask_pb2.FieldMask = proto.Field( + proto.MESSAGE, + number=5, + message=field_mask_pb2.FieldMask, + ) class BuildOptions(proto.Message): @@ -2856,6 +3069,10 @@ class BuildOptions(proto.Message): NOTE: this is always enabled for triggered builds and cannot be overridden in the build configuration file. + automap_substitutions (bool): + Option to include built-in and custom + substitutions as env variables for all build + steps. log_streaming_option (google.cloud.devtools.cloudbuild_v1.types.BuildOptions.LogStreamingOption): Option to define build log streaming behavior to Cloud Storage. @@ -3082,6 +3299,10 @@ class PoolOption(proto.Message): proto.BOOL, number=17, ) + automap_substitutions: bool = proto.Field( + proto.BOOL, + number=22, + ) log_streaming_option: LogStreamingOption = proto.Field( proto.ENUM, number=5, @@ -3172,6 +3393,125 @@ class ReceiveTriggerWebhookResponse(proto.Message): """ +class GitHubEnterpriseConfig(proto.Message): + r""" + + Attributes: + name (str): + Optional. The full resource name for the + GitHubEnterpriseConfig For example: + "projects/{$project_id}/locations/{$location_id}/githubEnterpriseConfigs/{$config_id}". + host_url (str): + The URL of the github enterprise host the + configuration is for. + app_id (int): + Required. The GitHub app id of the Cloud + Build app on the GitHub Enterprise server. + create_time (google.protobuf.timestamp_pb2.Timestamp): + Output only. Time when the installation was + associated with the project. + webhook_key (str): + The key that should be attached to webhook + calls to the ReceiveWebhook endpoint. + peered_network (str): + Optional. The network to be used when reaching out to the + GitHub Enterprise server. The VPC network must be enabled + for private service connection. This should be set if the + GitHub Enterprise server is hosted on-premises and not + reachable by public internet. If this field is left empty, + no network peering will occur and calls to the GitHub + Enterprise server will be made over the public internet. + Must be in the format + ``projects/{project}/global/networks/{network}``, where + {project} is a project number or id and {network} is the + name of a VPC network in the project. + secrets (google.cloud.devtools.cloudbuild_v1.types.GitHubEnterpriseSecrets): + Names of secrets in Secret Manager. + display_name (str): + Name to display for this config. + ssl_ca (str): + Optional. SSL certificate to use for requests + to GitHub Enterprise. + """ + + name: str = proto.Field( + proto.STRING, + number=7, + ) + host_url: str = proto.Field( + proto.STRING, + number=3, + ) + app_id: int = proto.Field( + proto.INT64, + number=4, + ) + create_time: timestamp_pb2.Timestamp = proto.Field( + proto.MESSAGE, + number=6, + message=timestamp_pb2.Timestamp, + ) + webhook_key: str = proto.Field( + proto.STRING, + number=8, + ) + peered_network: str = proto.Field( + proto.STRING, + number=9, + ) + secrets: "GitHubEnterpriseSecrets" = proto.Field( + proto.MESSAGE, + number=10, + message="GitHubEnterpriseSecrets", + ) + display_name: str = proto.Field( + proto.STRING, + number=11, + ) + ssl_ca: str = proto.Field( + proto.STRING, + number=12, + ) + + +class GitHubEnterpriseSecrets(proto.Message): + r"""GitHubEnterpriseSecrets represents the names of all necessary + secrets in Secret Manager for a GitHub Enterprise server. Format + is: projects//secrets/. + + Attributes: + private_key_version_name (str): + The resource name for the private key secret + version. + webhook_secret_version_name (str): + The resource name for the webhook secret + secret version in Secret Manager. + oauth_secret_version_name (str): + The resource name for the OAuth secret secret + version in Secret Manager. + oauth_client_id_version_name (str): + The resource name for the OAuth client ID + secret version in Secret Manager. + """ + + private_key_version_name: str = proto.Field( + proto.STRING, + number=5, + ) + webhook_secret_version_name: str = proto.Field( + proto.STRING, + number=6, + ) + oauth_secret_version_name: str = proto.Field( + proto.STRING, + number=7, + ) + oauth_client_id_version_name: str = proto.Field( + proto.STRING, + number=8, + ) + + class WorkerPool(proto.Message): r"""Configuration for a ``WorkerPool``. diff --git a/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v2/types/repositories.py b/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v2/types/repositories.py index 975e61bf10d2..62b41a0c393e 100644 --- a/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v2/types/repositories.py +++ b/packages/google-cloud-build/google/cloud/devtools/cloudbuild_v2/types/repositories.py @@ -475,6 +475,7 @@ class ServiceDirectoryConfig(proto.Message): service (str): Required. The Service Directory service name. Format: + projects/{project}/locations/{location}/namespaces/{namespace}/services/{service}. """ diff --git a/packages/google-cloud-build/samples/generated_samples/snippet_metadata_google.devtools.cloudbuild.v1.json b/packages/google-cloud-build/samples/generated_samples/snippet_metadata_google.devtools.cloudbuild.v1.json index 89703d207741..e379efab560f 100644 --- a/packages/google-cloud-build/samples/generated_samples/snippet_metadata_google.devtools.cloudbuild.v1.json +++ b/packages/google-cloud-build/samples/generated_samples/snippet_metadata_google.devtools.cloudbuild.v1.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-build", - "version": "3.19.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-build/samples/generated_samples/snippet_metadata_google.devtools.cloudbuild.v2.json b/packages/google-cloud-build/samples/generated_samples/snippet_metadata_google.devtools.cloudbuild.v2.json index 6995137b89fa..818d3fc2029c 100644 --- a/packages/google-cloud-build/samples/generated_samples/snippet_metadata_google.devtools.cloudbuild.v2.json +++ b/packages/google-cloud-build/samples/generated_samples/snippet_metadata_google.devtools.cloudbuild.v2.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-cloud-build", - "version": "3.19.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/packages/google-cloud-build/scripts/fixup_cloudbuild_v1_keywords.py b/packages/google-cloud-build/scripts/fixup_cloudbuild_v1_keywords.py index 78aabad9f31c..92866fb1f05b 100644 --- a/packages/google-cloud-build/scripts/fixup_cloudbuild_v1_keywords.py +++ b/packages/google-cloud-build/scripts/fixup_cloudbuild_v1_keywords.py @@ -55,7 +55,7 @@ class cloudbuildCallTransformer(cst.CSTTransformer): 'receive_trigger_webhook': ('name', 'body', 'project_id', 'trigger', 'secret', ), 'retry_build': ('project_id', 'id', 'name', ), 'run_build_trigger': ('project_id', 'trigger_id', 'name', 'source', ), - 'update_build_trigger': ('project_id', 'trigger_id', 'trigger', ), + 'update_build_trigger': ('project_id', 'trigger_id', 'trigger', 'update_mask', ), 'update_worker_pool': ('worker_pool', 'update_mask', 'validate_only', ), } diff --git a/packages/google-cloud-build/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py b/packages/google-cloud-build/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py index f5fb0f8c109e..2570d6354d41 100644 --- a/packages/google-cloud-build/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py +++ b/packages/google-cloud-build/tests/unit/gapic/cloudbuild_v1/test_cloud_build.py @@ -5294,6 +5294,7 @@ def test_create_build_rest(request_type): "exit_code": 948, "allow_exit_codes": [1702, 1703], "script": "script_value", + "automap_substitutions": True, } ], "results": { @@ -5374,6 +5375,7 @@ def test_create_build_rest(request_type): "disk_size_gb": 1261, "substitution_option": 1, "dynamic_substitutions": True, + "automap_substitutions": True, "log_streaming_option": 1, "worker_pool": "worker_pool_value", "pool": {"name": "name_value"}, @@ -5644,6 +5646,7 @@ def test_create_build_rest_bad_request( "exit_code": 948, "allow_exit_codes": [1702, 1703], "script": "script_value", + "automap_substitutions": True, } ], "results": { @@ -5724,6 +5727,7 @@ def test_create_build_rest_bad_request( "disk_size_gb": 1261, "substitution_option": 1, "dynamic_substitutions": True, + "automap_substitutions": True, "log_streaming_option": 1, "worker_pool": "worker_pool_value", "pool": {"name": "name_value"}, @@ -7403,6 +7407,7 @@ def test_create_build_trigger_rest(request_type): "exit_code": 948, "allow_exit_codes": [1702, 1703], "script": "script_value", + "automap_substitutions": True, } ], "results": { @@ -7486,6 +7491,7 @@ def test_create_build_trigger_rest(request_type): "disk_size_gb": 1261, "substitution_option": 1, "dynamic_substitutions": True, + "automap_substitutions": True, "log_streaming_option": 1, "worker_pool": "worker_pool_value", "pool": {"name": "name_value"}, @@ -7522,12 +7528,27 @@ def test_create_build_trigger_rest(request_type): "failure_info": {"type_": 1, "detail": "detail_value"}, }, "filename": "filename_value", + "git_file_source": { + "path": "path_value", + "uri": "uri_value", + "repository": "repository_value", + "repo_type": 1, + "revision": "revision_value", + "github_enterprise_config": "github_enterprise_config_value", + }, "create_time": {}, "disabled": True, "substitutions": {}, "ignored_files": ["ignored_files_value1", "ignored_files_value2"], "included_files": ["included_files_value1", "included_files_value2"], "filter": "filter_value", + "source_to_build": { + "uri": "uri_value", + "repository": "repository_value", + "ref": "ref_value", + "repo_type": 1, + "github_enterprise_config": "github_enterprise_config_value", + }, "service_account": "service_account_value", "repository_event_config": { "repository": "repository_value", @@ -7828,6 +7849,7 @@ def test_create_build_trigger_rest_bad_request( "exit_code": 948, "allow_exit_codes": [1702, 1703], "script": "script_value", + "automap_substitutions": True, } ], "results": { @@ -7911,6 +7933,7 @@ def test_create_build_trigger_rest_bad_request( "disk_size_gb": 1261, "substitution_option": 1, "dynamic_substitutions": True, + "automap_substitutions": True, "log_streaming_option": 1, "worker_pool": "worker_pool_value", "pool": {"name": "name_value"}, @@ -7947,12 +7970,27 @@ def test_create_build_trigger_rest_bad_request( "failure_info": {"type_": 1, "detail": "detail_value"}, }, "filename": "filename_value", + "git_file_source": { + "path": "path_value", + "uri": "uri_value", + "repository": "repository_value", + "repo_type": 1, + "revision": "revision_value", + "github_enterprise_config": "github_enterprise_config_value", + }, "create_time": {}, "disabled": True, "substitutions": {}, "ignored_files": ["ignored_files_value1", "ignored_files_value2"], "included_files": ["included_files_value1", "included_files_value2"], "filter": "filter_value", + "source_to_build": { + "uri": "uri_value", + "repository": "repository_value", + "ref": "ref_value", + "repo_type": 1, + "github_enterprise_config": "github_enterprise_config_value", + }, "service_account": "service_account_value", "repository_event_config": { "repository": "repository_value", @@ -9049,6 +9087,7 @@ def test_update_build_trigger_rest(request_type): "exit_code": 948, "allow_exit_codes": [1702, 1703], "script": "script_value", + "automap_substitutions": True, } ], "results": { @@ -9132,6 +9171,7 @@ def test_update_build_trigger_rest(request_type): "disk_size_gb": 1261, "substitution_option": 1, "dynamic_substitutions": True, + "automap_substitutions": True, "log_streaming_option": 1, "worker_pool": "worker_pool_value", "pool": {"name": "name_value"}, @@ -9168,12 +9208,27 @@ def test_update_build_trigger_rest(request_type): "failure_info": {"type_": 1, "detail": "detail_value"}, }, "filename": "filename_value", + "git_file_source": { + "path": "path_value", + "uri": "uri_value", + "repository": "repository_value", + "repo_type": 1, + "revision": "revision_value", + "github_enterprise_config": "github_enterprise_config_value", + }, "create_time": {}, "disabled": True, "substitutions": {}, "ignored_files": ["ignored_files_value1", "ignored_files_value2"], "included_files": ["included_files_value1", "included_files_value2"], "filter": "filter_value", + "source_to_build": { + "uri": "uri_value", + "repository": "repository_value", + "ref": "ref_value", + "repo_type": 1, + "github_enterprise_config": "github_enterprise_config_value", + }, "service_account": "service_account_value", "repository_event_config": { "repository": "repository_value", @@ -9258,6 +9313,8 @@ def test_update_build_trigger_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() ).update_build_trigger._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -9314,7 +9371,7 @@ def test_update_build_trigger_rest_unset_required_fields(): unset_fields = transport.update_build_trigger._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) + set(("updateMask",)) & set( ( "projectId", @@ -9477,6 +9534,7 @@ def test_update_build_trigger_rest_bad_request( "exit_code": 948, "allow_exit_codes": [1702, 1703], "script": "script_value", + "automap_substitutions": True, } ], "results": { @@ -9560,6 +9618,7 @@ def test_update_build_trigger_rest_bad_request( "disk_size_gb": 1261, "substitution_option": 1, "dynamic_substitutions": True, + "automap_substitutions": True, "log_streaming_option": 1, "worker_pool": "worker_pool_value", "pool": {"name": "name_value"}, @@ -9596,12 +9655,27 @@ def test_update_build_trigger_rest_bad_request( "failure_info": {"type_": 1, "detail": "detail_value"}, }, "filename": "filename_value", + "git_file_source": { + "path": "path_value", + "uri": "uri_value", + "repository": "repository_value", + "repo_type": 1, + "revision": "revision_value", + "github_enterprise_config": "github_enterprise_config_value", + }, "create_time": {}, "disabled": True, "substitutions": {}, "ignored_files": ["ignored_files_value1", "ignored_files_value2"], "included_files": ["included_files_value1", "included_files_value2"], "filter": "filter_value", + "source_to_build": { + "uri": "uri_value", + "repository": "repository_value", + "ref": "ref_value", + "repo_type": 1, + "github_enterprise_config": "github_enterprise_config_value", + }, "service_account": "service_account_value", "repository_event_config": { "repository": "repository_value", @@ -12430,9 +12504,32 @@ def test_parse_crypto_key_path(): assert expected == actual -def test_network_path(): +def test_github_enterprise_config_path(): project = "oyster" - network = "nudibranch" + config = "nudibranch" + expected = "projects/{project}/githubEnterpriseConfigs/{config}".format( + project=project, + config=config, + ) + actual = CloudBuildClient.github_enterprise_config_path(project, config) + assert expected == actual + + +def test_parse_github_enterprise_config_path(): + expected = { + "project": "cuttlefish", + "config": "mussel", + } + path = CloudBuildClient.github_enterprise_config_path(**expected) + + # Check that the path construction is reversible. + actual = CloudBuildClient.parse_github_enterprise_config_path(path) + assert expected == actual + + +def test_network_path(): + project = "winkle" + network = "nautilus" expected = "projects/{project}/global/networks/{network}".format( project=project, network=network, @@ -12443,8 +12540,8 @@ def test_network_path(): def test_parse_network_path(): expected = { - "project": "cuttlefish", - "network": "mussel", + "project": "scallop", + "network": "abalone", } path = CloudBuildClient.network_path(**expected) @@ -12454,10 +12551,10 @@ def test_parse_network_path(): def test_repository_path(): - project = "winkle" - location = "nautilus" - connection = "scallop" - repository = "abalone" + project = "squid" + location = "clam" + connection = "whelk" + repository = "octopus" expected = "projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}".format( project=project, location=location, @@ -12470,10 +12567,10 @@ def test_repository_path(): def test_parse_repository_path(): expected = { - "project": "squid", - "location": "clam", - "connection": "whelk", - "repository": "octopus", + "project": "oyster", + "location": "nudibranch", + "connection": "cuttlefish", + "repository": "mussel", } path = CloudBuildClient.repository_path(**expected) @@ -12483,9 +12580,9 @@ def test_parse_repository_path(): def test_secret_version_path(): - project = "oyster" - secret = "nudibranch" - version = "cuttlefish" + project = "winkle" + secret = "nautilus" + version = "scallop" expected = "projects/{project}/secrets/{secret}/versions/{version}".format( project=project, secret=secret, @@ -12497,9 +12594,9 @@ def test_secret_version_path(): def test_parse_secret_version_path(): expected = { - "project": "mussel", - "secret": "winkle", - "version": "nautilus", + "project": "abalone", + "secret": "squid", + "version": "clam", } path = CloudBuildClient.secret_version_path(**expected) @@ -12509,8 +12606,8 @@ def test_parse_secret_version_path(): def test_service_account_path(): - project = "scallop" - service_account = "abalone" + project = "whelk" + service_account = "octopus" expected = "projects/{project}/serviceAccounts/{service_account}".format( project=project, service_account=service_account, @@ -12521,8 +12618,8 @@ def test_service_account_path(): def test_parse_service_account_path(): expected = { - "project": "squid", - "service_account": "clam", + "project": "oyster", + "service_account": "nudibranch", } path = CloudBuildClient.service_account_path(**expected) @@ -12532,8 +12629,8 @@ def test_parse_service_account_path(): def test_subscription_path(): - project = "whelk" - subscription = "octopus" + project = "cuttlefish" + subscription = "mussel" expected = "projects/{project}/subscriptions/{subscription}".format( project=project, subscription=subscription, @@ -12544,8 +12641,8 @@ def test_subscription_path(): def test_parse_subscription_path(): expected = { - "project": "oyster", - "subscription": "nudibranch", + "project": "winkle", + "subscription": "nautilus", } path = CloudBuildClient.subscription_path(**expected) @@ -12555,8 +12652,8 @@ def test_parse_subscription_path(): def test_topic_path(): - project = "cuttlefish" - topic = "mussel" + project = "scallop" + topic = "abalone" expected = "projects/{project}/topics/{topic}".format( project=project, topic=topic, @@ -12567,8 +12664,8 @@ def test_topic_path(): def test_parse_topic_path(): expected = { - "project": "winkle", - "topic": "nautilus", + "project": "squid", + "topic": "clam", } path = CloudBuildClient.topic_path(**expected) @@ -12578,9 +12675,9 @@ def test_parse_topic_path(): def test_worker_pool_path(): - project = "scallop" - location = "abalone" - worker_pool = "squid" + project = "whelk" + location = "octopus" + worker_pool = "oyster" expected = ( "projects/{project}/locations/{location}/workerPools/{worker_pool}".format( project=project, @@ -12594,9 +12691,9 @@ def test_worker_pool_path(): def test_parse_worker_pool_path(): expected = { - "project": "clam", - "location": "whelk", - "worker_pool": "octopus", + "project": "nudibranch", + "location": "cuttlefish", + "worker_pool": "mussel", } path = CloudBuildClient.worker_pool_path(**expected) @@ -12606,7 +12703,7 @@ def test_parse_worker_pool_path(): def test_common_billing_account_path(): - billing_account = "oyster" + billing_account = "winkle" expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -12616,7 +12713,7 @@ def test_common_billing_account_path(): def test_parse_common_billing_account_path(): expected = { - "billing_account": "nudibranch", + "billing_account": "nautilus", } path = CloudBuildClient.common_billing_account_path(**expected) @@ -12626,7 +12723,7 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): - folder = "cuttlefish" + folder = "scallop" expected = "folders/{folder}".format( folder=folder, ) @@ -12636,7 +12733,7 @@ def test_common_folder_path(): def test_parse_common_folder_path(): expected = { - "folder": "mussel", + "folder": "abalone", } path = CloudBuildClient.common_folder_path(**expected) @@ -12646,7 +12743,7 @@ def test_parse_common_folder_path(): def test_common_organization_path(): - organization = "winkle" + organization = "squid" expected = "organizations/{organization}".format( organization=organization, ) @@ -12656,7 +12753,7 @@ def test_common_organization_path(): def test_parse_common_organization_path(): expected = { - "organization": "nautilus", + "organization": "clam", } path = CloudBuildClient.common_organization_path(**expected) @@ -12666,7 +12763,7 @@ def test_parse_common_organization_path(): def test_common_project_path(): - project = "scallop" + project = "whelk" expected = "projects/{project}".format( project=project, ) @@ -12676,7 +12773,7 @@ def test_common_project_path(): def test_parse_common_project_path(): expected = { - "project": "abalone", + "project": "octopus", } path = CloudBuildClient.common_project_path(**expected) @@ -12686,8 +12783,8 @@ def test_parse_common_project_path(): def test_common_location_path(): - project = "squid" - location = "clam" + project = "oyster" + location = "nudibranch" expected = "projects/{project}/locations/{location}".format( project=project, location=location, @@ -12698,8 +12795,8 @@ def test_common_location_path(): def test_parse_common_location_path(): expected = { - "project": "whelk", - "location": "octopus", + "project": "cuttlefish", + "location": "mussel", } path = CloudBuildClient.common_location_path(**expected)