Skip to content

Commit

Permalink
feat: [google-cloud-deploy] add Skaffold remote config support for GC…
Browse files Browse the repository at this point in the history
…B repos (#12596)

- [ ] Regenerate this pull request now.


BEGIN_COMMIT_OVERRIDE
docs: clarified related comments
feat: add Skaffold remote config support for GCB repos
END_COMMIT_OVERRIDE


PiperOrigin-RevId: 626346409

Source-Link:
googleapis/googleapis@357c057

Source-Link:
googleapis/googleapis-gen@06261c1
Copy-Tag:
eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRlcGxveS8uT3dsQm90LnlhbWwiLCJoIjoiMDYyNjFjMTI0YTg0MzRlZGYwZDBjYTcwZjg2ZDFkMmYyYWVjMTg1MSJ9

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <partheniou@google.com>
  • Loading branch information
3 people committed Apr 19, 2024
1 parent 741695a commit bd918e6
Show file tree
Hide file tree
Showing 5 changed files with 163 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ class CloudDeployAsyncClient:
parse_membership_path = staticmethod(CloudDeployClient.parse_membership_path)
release_path = staticmethod(CloudDeployClient.release_path)
parse_release_path = staticmethod(CloudDeployClient.parse_release_path)
repository_path = staticmethod(CloudDeployClient.repository_path)
parse_repository_path = staticmethod(CloudDeployClient.parse_repository_path)
rollout_path = staticmethod(CloudDeployClient.rollout_path)
parse_rollout_path = staticmethod(CloudDeployClient.parse_rollout_path)
service_path = staticmethod(CloudDeployClient.service_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,30 @@ def parse_release_path(path: str) -> Dict[str, str]:
)
return m.groupdict() if m else {}

@staticmethod
def repository_path(
project: str,
location: str,
connection: str,
repository: str,
) -> str:
"""Returns a fully-qualified repository string."""
return "projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}".format(
project=project,
location=location,
connection=connection,
repository=repository,
)

@staticmethod
def parse_repository_path(path: str) -> Dict[str, str]:
"""Parses a repository path into its component segments."""
m = re.match(
r"^projects/(?P<project>.+?)/locations/(?P<location>.+?)/connections/(?P<connection>.+?)/repositories/(?P<repository>.+?)$",
path,
)
return m.groupdict() if m else {}

@staticmethod
def rollout_path(
project: str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5846,6 +5846,10 @@ def __call__(
"method": "get",
"uri": "/v1/{resource=projects/*/locations/*/targets/*}:getIamPolicy",
},
{
"method": "get",
"uri": "/v1/{resource=projects/*/locations/*/customTargetTypes/*}:getIamPolicy",
},
]

request, metadata = self._interceptor.pre_get_iam_policy(request, metadata)
Expand Down Expand Up @@ -5918,6 +5922,11 @@ def __call__(
"uri": "/v1/{resource=projects/*/locations/*/targets/*}:setIamPolicy",
"body": "*",
},
{
"method": "post",
"uri": "/v1/{resource=projects/*/locations/*/customTargetTypes/*}:setIamPolicy",
"body": "*",
},
]

request, metadata = self._interceptor.pre_set_iam_policy(request, metadata)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2318,6 +2318,11 @@ class SkaffoldModules(proto.Message):
Cloud Storage bucket containing the Skaffold
Config modules.
This field is a member of `oneof`_ ``source``.
google_cloud_build_repo (google.cloud.deploy_v1.types.SkaffoldModules.SkaffoldGCBRepoSource):
Cloud Build V2 repository containing the
Skaffold Config modules.
This field is a member of `oneof`_ ``source``.
"""

Expand All @@ -2332,8 +2337,8 @@ class SkaffoldGitSource(proto.Message):
Optional. Relative path from the repository
root to the Skaffold file.
ref (str):
Optional. Git ref the package should be
cloned from.
Optional. Git branch or tag to use when
cloning the repository.
"""

repo: str = proto.Field(
Expand All @@ -2355,7 +2360,7 @@ class SkaffoldGCSSource(proto.Message):
Attributes:
source (str):
Required. Cloud Storage source paths to copy recursively.
For example, providing "gs://my-bucket/dir/configs/*" will
For example, providing `gs://my-bucket/dir/configs/*` will
result in Skaffold copying all files within the
"dir/configs" directory in the bucket "my-bucket".
path (str):
Expand All @@ -2372,6 +2377,35 @@ class SkaffoldGCSSource(proto.Message):
number=2,
)

class SkaffoldGCBRepoSource(proto.Message):
r"""Cloud Build V2 Repository containing Skaffold Configs.
Attributes:
repository (str):
Required. Name of the Cloud Build V2
Repository. Format is
projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}.
path (str):
Optional. Relative path from the repository
root to the Skaffold Config file.
ref (str):
Optional. Branch or tag to use when cloning
the repository.
"""

repository: str = proto.Field(
proto.STRING,
number=1,
)
path: str = proto.Field(
proto.STRING,
number=2,
)
ref: str = proto.Field(
proto.STRING,
number=3,
)

configs: MutableSequence[str] = proto.RepeatedField(
proto.STRING,
number=1,
Expand All @@ -2388,6 +2422,12 @@ class SkaffoldGCSSource(proto.Message):
oneof="source",
message=SkaffoldGCSSource,
)
google_cloud_build_repo: SkaffoldGCBRepoSource = proto.Field(
proto.MESSAGE,
number=4,
oneof="source",
message=SkaffoldGCBRepoSource,
)


class ListCustomTargetTypesRequest(proto.Message):
Expand Down
Loading

0 comments on commit bd918e6

Please sign in to comment.