diff --git a/docs-v2/content/en/schemas/v4beta12.json b/docs-v2/content/en/schemas/v4beta12.json index c03e49403ab..441e9bc9ee5 100755 --- a/docs-v2/content/en/schemas/v4beta12.json +++ b/docs-v2/content/en/schemas/v4beta12.json @@ -2041,6 +2041,11 @@ }, "GoogleCloudBuild": { "properties": { + "bucket": { + "type": "string", + "description": "specifies the Cloud Storage bucket to store the staged build sources.", + "x-intellij-html-description": "specifies the Cloud Storage bucket to store the staged build sources." + }, "concurrency": { "type": "integer", "description": "how many artifacts can be built concurrently. 0 means \"no-limit\".", @@ -2157,6 +2162,7 @@ "gradleImage", "packImage", "koImage", + "bucket", "concurrency", "workerPool", "region", diff --git a/pkg/skaffold/build/gcb/cloud_build.go b/pkg/skaffold/build/gcb/cloud_build.go index d12ee302f96..920ba600dec 100644 --- a/pkg/skaffold/build/gcb/cloud_build.go +++ b/pkg/skaffold/build/gcb/cloud_build.go @@ -106,7 +106,12 @@ func (b *Builder) buildArtifactWithCloudBuild(ctx context.Context, out io.Writer } log.Entry(ctx).Debugf("project id set to %s", projectID) - cbBucket := fmt.Sprintf("%s%s", projectID, constants.GCSBucketSuffix) + cbBucket := b.Bucket + if cbBucket == "" { + cbBucket = fmt.Sprintf("%s%s", projectID, constants.GCSBucketSuffix) + } + log.Entry(ctx).Debugf("bucket set to %s", cbBucket) + buildObject := fmt.Sprintf("source/%s-%s.tar.gz", projectID, uuid.New().String()) if err := b.createBucketIfNotExists(ctx, c, projectID, cbBucket); err != nil { diff --git a/pkg/skaffold/schema/latest/config.go b/pkg/skaffold/schema/latest/config.go index cf999b2851d..3623942673b 100644 --- a/pkg/skaffold/schema/latest/config.go +++ b/pkg/skaffold/schema/latest/config.go @@ -450,6 +450,9 @@ type GoogleCloudBuild struct { // Defaults to `gcr.io/k8s-skaffold/skaffold`. KoImage string `yaml:"koImage,omitempty"` + // Bucket specifies the Cloud Storage bucket to store the staged build sources. + Bucket string `yaml:"bucket,omitempty"` + // Concurrency is how many artifacts can be built concurrently. 0 means "no-limit". // Defaults to `0`. Concurrency int `yaml:"concurrency,omitempty"`