Skip to content

Commit

Permalink
chore(cloudbuild): add configurable source bucket
Browse files Browse the repository at this point in the history
This pull request introduces a new configurable parameter for specifying a custom bucket.
For example, the bucket name could follow the format `gs://[PROJECT_ID]_[builds/region]_cloudbuild`.
  • Loading branch information
shikanime committed Jun 12, 2024
1 parent 64585c1 commit 8cab2dd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/skaffold/build/gcb/cloud_build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions pkg/skaffold/schema/latest/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down

0 comments on commit 8cab2dd

Please sign in to comment.