Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TemplateField for build.artifacts.docker.cliFlags #9582

Merged

Conversation

kitagry
Copy link
Contributor

@kitagry kitagry commented Nov 23, 2024

Fixes: #9581

Description

Upon installing Docker Buildx, the docker build command becomes an alias for docker buildx build. This means that any subsequent docker build commands will be executed using the more advanced features provided by Buildx. Specifically, we intend to leverage the --cache-to=type=registry,ref=repo/image:tag flag within these commands. In order to several registry, I want to TemplateField for build.artifacts.docker.cliFlags as following.

build:
  artifacts:
    - image: repo/image
      context: .
      docker:
        dockerfile: Dockerfile
        cliFlags:
          - "--cache-to={{ .IMAGE_REPO }}/{{ .IMAGE_NAME }}:latest-cache"

User facing changes (remove if N/A)

User can use TemplateField in cliFlags.

Copy link

google-cla bot commented Nov 23, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@louisjimenez louisjimenez self-requested a review November 27, 2024 19:57
@@ -106,6 +106,12 @@ func (b *Builder) dockerCLIBuild(ctx context.Context, out io.Writer, name string
if err != nil {
return "", fmt.Errorf("unable to evaluate build args: %w", err)
}
for i, cliFlag := range a.CliFlags {

Choose a reason for hiding this comment

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

Is this something that can be moved to where the other cli args are built: https://github.com/GoogleContainerTools/skaffold/blob/main/pkg/skaffold/docker/image.go#L629? I believe that would also add support for the GCB case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry for the late reply. I fixed it!

@kitagry kitagry requested a review from a team as a code owner December 14, 2024 06:30
@kitagry kitagry requested a review from katiexzhang December 14, 2024 06:30
@kitagry kitagry force-pushed the template-field-with-cli-flags branch 2 times, most recently from ec0b09c to 3730f8c Compare December 14, 2024 06:33
@kitagry kitagry force-pushed the template-field-with-cli-flags branch from 3730f8c to fa93f3e Compare December 14, 2024 06:35
@louisjimenez louisjimenez merged commit ff741e3 into GoogleContainerTools:main Dec 16, 2024
11 checks passed
@kitagry kitagry deleted the template-field-with-cli-flags branch December 17, 2024 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Support TemplatedField for build.artifacts.docker.cliFlags
2 participants