Skip to content

feat: add generic BuildArgs for BuildpackArtifact#9745

Merged
Darien-Lin merged 1 commit into
GoogleContainerTools:mainfrom
unburdenedio:buildpack-docker-network
Apr 22, 2026
Merged

feat: add generic BuildArgs for BuildpackArtifact#9745
Darien-Lin merged 1 commit into
GoogleContainerTools:mainfrom
unburdenedio:buildpack-docker-network

Conversation

@bogdannazarenko

@bogdannazarenko bogdannazarenko commented Mar 5, 2025

Copy link
Copy Markdown
Contributor

Fixes: #9744
Related: N/A
Merge before/after: N/A

Description

Adding generic BuildArgs []string field on BuildpackArtifact. This allows users to pass any additional args to pack build (e.g. --network, --cache-image) without requiring future schema changes.

Example problem: GCP CloudBuild application default credentials are only available on docker network "cloudbuild," hence we need to specify that network for build pack to access that network for proper workload identity authentication for access to things such as Artifact Registries.

User facing changes (remove if N/A)

Addition property available to set on buildpack image build configurations.

@bogdannazarenko bogdannazarenko marked this pull request as ready for review March 5, 2025 17:32
@bogdannazarenko bogdannazarenko requested a review from a team as a code owner March 5, 2025 17:32
@bogdannazarenko bogdannazarenko force-pushed the buildpack-docker-network branch from b505750 to e2be8b7 Compare March 25, 2025 00:19
@bogdannazarenko bogdannazarenko force-pushed the buildpack-docker-network branch from e2be8b7 to 27840b2 Compare April 17, 2025 03:22
@bogdannazarenko bogdannazarenko force-pushed the buildpack-docker-network branch from 27840b2 to 1b289df Compare April 17, 2025 03:24
@bogdannazarenko

Copy link
Copy Markdown
Contributor Author

@Darien-Lin @katiexzhang @menahyouyeah I generate a new schema version and added by schema changes for the buildpack build Network property. Could one you you please check and trigger further tests? Thank you

@bogdannazarenko bogdannazarenko changed the title feat: schema addition to specify contianer build network for buildpack Apr 17, 2025
@menahyouyeah

Copy link
Copy Markdown
Contributor

Would it be possible to split this into 2 commits - one with all the schema related changes and another with the logic changes to make it easier to review?

@menahyouyeah menahyouyeah self-assigned this Apr 28, 2025
Comment thread pkg/skaffold/schema/latest/config.go Outdated
// Volumes support mounting host volumes into the container.
Volumes []*BuildpackVolume `yaml:"volumes,omitempty"`

// Network is the network to use for the build.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding just the Network arg can you do something similar to #9696. Basically a BuildArgs []string or something along those lines so that in the future if people wanted to pass additional args there wouldn't need to be any additional logic or schema change.

@bogdannazarenko bogdannazarenko Apr 6, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@menahyouyeah I implemented your suggestion with general BuildArgs property. Please re-review when you get a second

@bogdannazarenko bogdannazarenko force-pushed the buildpack-docker-network branch from 295ee9c to c26c781 Compare April 6, 2026 20:48
@bogdannazarenko bogdannazarenko force-pushed the buildpack-docker-network branch 2 times, most recently from 8f11f57 to 8040e64 Compare April 6, 2026 21:05
@bogdannazarenko bogdannazarenko changed the title feat: new schema version with addition to specify contianer build network for buildpack Apr 8, 2026
@bogdannazarenko

Copy link
Copy Markdown
Contributor Author

@Darien-Lin @katiexzhang @menahyouyeah could you please re-review when you get a chance? Thank you

@Darien-Lin

Copy link
Copy Markdown
Contributor

Generally the maintainers of this Github is responsible for bumping up schema changes as there is a process to follow. Can you revert the schema changes and just have the new flags?

@bogdannazarenko bogdannazarenko force-pushed the buildpack-docker-network branch from 8040e64 to fc3e326 Compare April 22, 2026 14:25
@bogdannazarenko

Copy link
Copy Markdown
Contributor Author

@Darien-Lin I removed schema changes. Thank you

@bogdannazarenko

Copy link
Copy Markdown
Contributor Author

Generally the maintainers of this Github is responsible for bumping up schema changes as there is a process to follow. Can you revert the schema changes and just have the new flags?

@Darien-Lin just fyi, the DEVELOPMENT.md instructs to generate a new schema version and commit. I'm unable to build the binary if I don't generate the schema.

➜ make          
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 \
            go build -mod="vendor" -gcflags="all=-N -l" -tags "timetzdata release " -ldflags "-X github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/version.version=v2.14.0-56-gfc3e3263e -X github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/version.buildDate=2026-04-22T11:18:36Z -X github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/version.gitCommit=fc3e3263e34a617bf5336915b1550355e5c19e2d -s -w " -o out/skaffold github.com/GoogleContainerTools/skaffold/v2/cmd/skaffold
# github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/build/gcb
pkg/skaffold/build/gcb/buildpacks.go:51:31: artifact.BuildArgs undefined (type *"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/latest".BuildpackArtifact has no field or method BuildArgs)
make: *** [out/skaffold] Error 1

Are those docs intended for Maintainers? Should I update with a note that it's for maintainer only?

@Darien-Lin

Copy link
Copy Markdown
Contributor

Generally the maintainers of this Github is responsible for bumping up schema changes as there is a process to follow. Can you revert the schema changes and just have the new flags?

@Darien-Lin just fyi, the DEVELOPMENT.md instructs to generate a new schema version and commit. I'm unable to build the binary if I don't generate the schema.

➜ make          
GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 \
            go build -mod="vendor" -gcflags="all=-N -l" -tags "timetzdata release " -ldflags "-X github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/version.version=v2.14.0-56-gfc3e3263e -X github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/version.buildDate=2026-04-22T11:18:36Z -X github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/version.gitCommit=fc3e3263e34a617bf5336915b1550355e5c19e2d -s -w " -o out/skaffold github.com/GoogleContainerTools/skaffold/v2/cmd/skaffold
# github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/build/gcb
pkg/skaffold/build/gcb/buildpacks.go:51:31: artifact.BuildArgs undefined (type *"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/schema/latest".BuildpackArtifact has no field or method BuildArgs)
make: *** [out/skaffold] Error 1

Are those docs intended for Maintainers? Should I update with a note that it's for maintainer only?

I am attempting to make the cut here: #10059
From what I can tell, in the past, we've allowed developers to submit the code changes with the config update, but since there's quite a bit of diffs now, we've generally had maintainers do it. I think the doc should be updated.

@Darien-Lin

Copy link
Copy Markdown
Contributor

I have made the cut, so feel free to rebase and add the new fields

@Darien-Lin Darien-Lin left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The config struct needs to be updated to have these new fields

Added generic BuildArgs []string field on BuildpackArtifact. This allows users to pass any additional args to `pack build` (e.g. --network, --cache-image) without requiring future schema changes.

Signed-off-by: Bogdan Nazarenko <bogdan.nazarenko@outlook.com>
@bogdannazarenko bogdannazarenko force-pushed the buildpack-docker-network branch from dcd07a3 to 1df724c Compare April 22, 2026 19:54
@pull-request-size pull-request-size Bot added size/M and removed size/S labels Apr 22, 2026
@bogdannazarenko

Copy link
Copy Markdown
Contributor Author

The config struct needs to be updated to have these new fields

yep, thank you @Darien-Lin. I rebased and updated the structure.

@bogdannazarenko

Copy link
Copy Markdown
Contributor Author
@Darien-Lin Darien-Lin added the kokoro:force-run forces a kokoro re-run on a PR label Apr 22, 2026
@kokoro-team kokoro-team removed the kokoro:force-run forces a kokoro re-run on a PR label Apr 22, 2026
@Darien-Lin Darien-Lin merged commit 8a894ee into GoogleContainerTools:main Apr 22, 2026
9 of 12 checks passed
@bogdannazarenko

Copy link
Copy Markdown
Contributor Author

@Darien-Lin thanks for your help

@bogdannazarenko bogdannazarenko deleted the buildpack-docker-network branch April 22, 2026 21:11
orospakr pushed a commit to orospakr/skaffold-spawnexec that referenced this pull request May 14, 2026
…ls#9745)

feat: add generic BuildArgs on BuildpackArtifact

Added generic BuildArgs []string field on BuildpackArtifact. This allows users to pass any additional args to `pack build` (e.g. --network, --cache-image) without requiring future schema changes.

Signed-off-by: Bogdan Nazarenko <bogdan.nazarenko@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4 participants