Skip to content

Commit

Permalink
patch GCP build repo name (#4501)
Browse files Browse the repository at this point in the history
  • Loading branch information
d-g-town authored Apr 4, 2024
1 parent d5c9118 commit f31144c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cli/cmd/v2/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,17 @@ func build(ctx context.Context, client api.Client, inp buildInput) buildOutput {
output.Error = errors.New("must specify a registry url")
return output
}

repositoryURL := strings.TrimPrefix(inp.RepositoryURL, "https://")

// this should catch the following v1 GCP repo format:
// us-central1-docker.pkg.dev/GCP_PROJECT/porter-PORTER_PROJECT/APP_NAME-porter-stack-APP_NAME/APP_NAME-porter-stack-APP_NAME
// and convert it to:
// us-central1-docker.pkg.dev/GCP_PROJECT/porter-PORTER_PROJECT/APP_NAME
if splits := strings.Split(repositoryURL, "porter-stack"); len(splits) == 3 {
repositoryURL = strings.TrimSuffix(splits[0], "-")
}

err := createImageRepositoryIfNotExists(ctx, client, projectID, repositoryURL)
if err != nil {
output.Error = fmt.Errorf("error creating image repository: %w", err)
Expand Down

0 comments on commit f31144c

Please sign in to comment.