Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [Deploy] add Skaffold remote config support for GCB repos #7248

Merged
merged 2 commits into from
Apr 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified Deploy/metadata/V1/CloudDeploy.php
Binary file not shown.
22 changes: 22 additions & 0 deletions Deploy/src/V1/Client/CloudDeployClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,27 @@ public static function releaseName(string $project, string $location, string $de
]);
}

/**
* Formats a string containing the fully-qualified path to represent a repository
* resource.
*
* @param string $project
* @param string $location
* @param string $connection
* @param string $repository
*
* @return string The formatted repository resource.
*/
public static function repositoryName(string $project, string $location, string $connection, string $repository): string
{
return self::getPathTemplate('repository')->render([
'project' => $project,
'location' => $location,
'connection' => $connection,
'repository' => $repository,
]);
}

/**
* Formats a string containing the fully-qualified path to represent a rollout
* resource.
Expand Down Expand Up @@ -573,6 +594,7 @@ public static function workerPoolName(string $project, string $location, string
* - location: projects/{project}/locations/{location}
* - membership: projects/{project}/locations/{location}/memberships/{membership}
* - release: projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}
* - repository: projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}
* - rollout: projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}
* - service: projects/{project}/locations/{location}/services/{service}
* - target: projects/{project}/locations/{location}/targets/{target}
Expand Down
40 changes: 40 additions & 0 deletions Deploy/src/V1/Gapic/CloudDeployGapicClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ class CloudDeployGapicClient

private static $releaseNameTemplate;

private static $repositoryNameTemplate;

private static $rolloutNameTemplate;

private static $serviceNameTemplate;
Expand Down Expand Up @@ -361,6 +363,17 @@ private static function getReleaseNameTemplate()
return self::$releaseNameTemplate;
}

private static function getRepositoryNameTemplate()
{
if (self::$repositoryNameTemplate == null) {
self::$repositoryNameTemplate = new PathTemplate(
'projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}'
);
}

return self::$repositoryNameTemplate;
}

private static function getRolloutNameTemplate()
{
if (self::$rolloutNameTemplate == null) {
Expand Down Expand Up @@ -421,6 +434,7 @@ private static function getPathTemplateMap()
'location' => self::getLocationNameTemplate(),
'membership' => self::getMembershipNameTemplate(),
'release' => self::getReleaseNameTemplate(),
'repository' => self::getRepositoryNameTemplate(),
'rollout' => self::getRolloutNameTemplate(),
'service' => self::getServiceNameTemplate(),
'target' => self::getTargetNameTemplate(),
Expand Down Expand Up @@ -691,6 +705,31 @@ public static function releaseName(
]);
}

/**
* Formats a string containing the fully-qualified path to represent a repository
* resource.
*
* @param string $project
* @param string $location
* @param string $connection
* @param string $repository
*
* @return string The formatted repository resource.
*/
public static function repositoryName(
$project,
$location,
$connection,
$repository
) {
return self::getRepositoryNameTemplate()->render([
'project' => $project,
'location' => $location,
'connection' => $connection,
'repository' => $repository,
]);
}

/**
* Formats a string containing the fully-qualified path to represent a rollout
* resource.
Expand Down Expand Up @@ -792,6 +831,7 @@ public static function workerPoolName($project, $location, $workerPool)
* - location: projects/{project}/locations/{location}
* - membership: projects/{project}/locations/{location}/memberships/{membership}
* - release: projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}
* - repository: projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}
* - rollout: projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}
* - service: projects/{project}/locations/{location}/services/{service}
* - target: projects/{project}/locations/{location}/targets/{target}
Expand Down
33 changes: 33 additions & 0 deletions Deploy/src/V1/SkaffoldModules.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

148 changes: 148 additions & 0 deletions Deploy/src/V1/SkaffoldModules/SkaffoldGCBRepoSource.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions Deploy/src/V1/SkaffoldModules/SkaffoldGitSource.php

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@
'location' => 'projects/{project}/locations/{location}',
'membership' => 'projects/{project}/locations/{location}/memberships/{membership}',
'release' => 'projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}',
'repository' => 'projects/{project}/locations/{location}/connections/{connection}/repositories/{repository}',
'rollout' => 'projects/{project}/locations/{location}/deliveryPipelines/{delivery_pipeline}/releases/{release}/rollouts/{rollout}',
'service' => 'projects/{project}/locations/{location}/services/{service}',
'target' => 'projects/{project}/locations/{location}/targets/{target}',
Expand Down
9 changes: 9 additions & 0 deletions Deploy/src/V1/resources/cloud_deploy_rest_client_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,10 @@
'method' => 'get',
'uriTemplate' => '/v1/{resource=projects/*/locations/*/targets/*}:getIamPolicy',
],
[
'method' => 'get',
'uriTemplate' => '/v1/{resource=projects/*/locations/*/customTargetTypes/*}:getIamPolicy',
],
],
'placeholders' => [
'resource' => [
Expand All @@ -569,6 +573,11 @@
'uriTemplate' => '/v1/{resource=projects/*/locations/*/targets/*}:setIamPolicy',
'body' => '*',
],
[
'method' => 'post',
'uriTemplate' => '/v1/{resource=projects/*/locations/*/customTargetTypes/*}:setIamPolicy',
'body' => '*',
],
],
'placeholders' => [
'resource' => [
Expand Down
Loading