Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit ae09144

Browse files
authored
sg/msp: update CloudDeploy helper comment (#61164)
1 parent 6aca0e6 commit ae09144

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

dev/sg/msp/helpers.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ func generateTerraform(serviceID string, opts generateTerraformOptions) error {
194194
}
195195

196196
deploySpecFilename := fmt.Sprintf("rollout-%s.clouddeploy.yaml", region)
197-
comment := generateCloudDeployDocstring(env.ProjectID, region, deploySpecFilename)
197+
comment := generateCloudDeployDocstring(env.ProjectID, serviceID, region, deploySpecFilename)
198198
if err := os.WriteFile(
199199
filepath.Join(filepath.Dir(serviceSpecPath), deploySpecFilename),
200200
append([]byte(comment), deploySpec.Bytes()...),
@@ -247,20 +247,20 @@ func isHandbookRepo(relPath string) error {
247247
return errors.Newf("unexpected package %q", packageJSON.Name)
248248
}
249249

250-
func generateCloudDeployDocstring(projectID, gcpRegion, cloudDeployFilename string) string {
250+
func generateCloudDeployDocstring(projectID, serviceID, gcpRegion, cloudDeployFilename string) string {
251251
return fmt.Sprintf(`# DO NOT EDIT; generated by 'sg msp generate'
252252
#
253253
# This file defines additional Cloud Deploy configuration that is not yet available in Terraform.
254254
# Apply this using the following command:
255255
#
256-
# gcloud deploy apply --project=%[1]s --region=%[2]s --file=%[3]s
256+
# gcloud deploy apply --project=%[1]s --region=%[3]s --file=%[4]s
257257
#
258258
# Releases can be created using the following command, which can be added to CI pipelines:
259259
#
260-
# gcloud deploy releases create $RELEASE_NAME --labels="commit=$COMMIT,author=$AUTHOR" --deploy-parameters="customTarget/tag=$TAG" --project=%[1]s --region=%[2]s --delivery-pipeline=%[1]s-%[2]s-rollout --source='gs://%[1]s-cloudrun-skaffold/source.tar.gz'
260+
# gcloud deploy releases create $RELEASE_NAME --labels="commit=$COMMIT,author=$AUTHOR" --deploy-parameters="customTarget/tag=$TAG" --project=%[1]s --region=%[3]s --delivery-pipeline=%[2]s-%[3]s-rollout --source='gs://%[1]s-cloudrun-skaffold/source.tar.gz'
261261
#
262262
# The secret 'cloud_deploy_releaser_service_account_id' provides the ID of a service account
263263
# that can be used to provision workload auth, for example https://sourcegraph.sourcegraph.com/github.com/sourcegraph/infrastructure/-/blob/managed-services/continuous-deployment-pipeline/main.tf?L5-20
264264
`, // TODO improve the releases DX
265-
projectID, gcpRegion, cloudDeployFilename)
265+
projectID, serviceID, gcpRegion, cloudDeployFilename)
266266
}

dev/sg/msp/helpers_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
)
88

99
func TestGenerateCloudDeployDocstring(t *testing.T) {
10-
comment := generateCloudDeployDocstring("PROJECT_ID", "REGION", "rollout-REGION.clouddeploy.yaml")
10+
comment := generateCloudDeployDocstring("PROJECT_ID", "SERVICE_ID", "REGION", "rollout-REGION.clouddeploy.yaml")
1111
autogold.Expect(`# DO NOT EDIT; generated by 'sg msp generate'
1212
#
1313
# This file defines additional Cloud Deploy configuration that is not yet available in Terraform.
@@ -17,7 +17,7 @@ func TestGenerateCloudDeployDocstring(t *testing.T) {
1717
#
1818
# Releases can be created using the following command, which can be added to CI pipelines:
1919
#
20-
# gcloud deploy releases create $RELEASE_NAME --labels="commit=$COMMIT,author=$AUTHOR" --deploy-parameters="customTarget/tag=$TAG" --project=PROJECT_ID --region=REGION --delivery-pipeline=PROJECT_ID-REGION-rollout --source='gs://PROJECT_ID-cloudrun-skaffold/source.tar.gz'
20+
# gcloud deploy releases create $RELEASE_NAME --labels="commit=$COMMIT,author=$AUTHOR" --deploy-parameters="customTarget/tag=$TAG" --project=PROJECT_ID --region=REGION --delivery-pipeline=SERVICE_ID-REGION-rollout --source='gs://PROJECT_ID-cloudrun-skaffold/source.tar.gz'
2121
#
2222
# The secret 'cloud_deploy_releaser_service_account_id' provides the ID of a service account
2323
# that can be used to provision workload auth, for example https://sourcegraph.sourcegraph.com/github.com/sourcegraph/infrastructure/-/blob/managed-services/continuous-deployment-pipeline/main.tf?L5-20

0 commit comments

Comments
 (0)