Skip to content

Commit f31144c

Browse files
authored
patch GCP build repo name (#4501)
1 parent d5c9118 commit f31144c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cli/cmd/v2/build.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,17 @@ func build(ctx context.Context, client api.Client, inp buildInput) buildOutput {
7171
output.Error = errors.New("must specify a registry url")
7272
return output
7373
}
74+
7475
repositoryURL := strings.TrimPrefix(inp.RepositoryURL, "https://")
7576

77+
// this should catch the following v1 GCP repo format:
78+
// us-central1-docker.pkg.dev/GCP_PROJECT/porter-PORTER_PROJECT/APP_NAME-porter-stack-APP_NAME/APP_NAME-porter-stack-APP_NAME
79+
// and convert it to:
80+
// us-central1-docker.pkg.dev/GCP_PROJECT/porter-PORTER_PROJECT/APP_NAME
81+
if splits := strings.Split(repositoryURL, "porter-stack"); len(splits) == 3 {
82+
repositoryURL = strings.TrimSuffix(splits[0], "-")
83+
}
84+
7685
err := createImageRepositoryIfNotExists(ctx, client, projectID, repositoryURL)
7786
if err != nil {
7887
output.Error = fmt.Errorf("error creating image repository: %w", err)

0 commit comments

Comments
 (0)