Skip to content

Pass buildArgs to Kaniko#822

Merged
dgageot merged 4 commits intoGoogleContainerTools:masterfrom
JoelPM:821_kaniko_build_args
Jul 18, 2018
Merged

Pass buildArgs to Kaniko#822
dgageot merged 4 commits intoGoogleContainerTools:masterfrom
JoelPM:821_kaniko_build_args

Conversation

@JoelPM
Copy link
Copy Markdown
Contributor

@JoelPM JoelPM commented Jul 13, 2018

If buildArgs are present in skaffold.yaml for the Docker configuration pass them through to kaniko. Addresses #821

This is likely not idiomatic golang, happy to update based on feedback.

If buildArgs are present in skaffold.yaml for the Docker configuration,
pass them through to kaniko. Addresses #821
@googlebot
Copy link
Copy Markdown

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

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@JoelPM
Copy link
Copy Markdown
Contributor Author

JoelPM commented Jul 13, 2018

CLA is signed.

@googlebot
Copy link
Copy Markdown

CLAs look good, thanks!


i := len(args)
for k, v := range artifact.DockerArtifact.BuildArgs {
withBuildArgs[i] = fmt.Sprintf("--build-arg=%s=%s", k, *v)
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.

you can use append(args, fmt.Sprintf("--build-arg=%s=%s", k, *v)

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.

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.

Updated based on feedback. That's definitely cleaner.

@JoelPM
Copy link
Copy Markdown
Contributor Author

JoelPM commented Jul 17, 2018

@r2d4 - Made the changes you suggested, any other changes you'd like to see?

Copy link
Copy Markdown
Contributor

@r2d4 r2d4 left a comment

Choose a reason for hiding this comment

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

LGTM Thanks!!

@r2d4 r2d4 added the kokoro:run runs the kokoro jobs on a PR label Jul 17, 2018
Copy link
Copy Markdown
Contributor

@dgageot dgageot left a comment

Choose a reason for hiding this comment

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

LGTM with a nit

return args
}

if artifact.DockerArtifact.BuildArgs == nil || len(artifact.DockerArtifact.BuildArgs) == 0 {
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.

Can be replaced with if len(artifact.DockerArtifact.BuildArgs) == 0

@kokoro-team kokoro-team removed the kokoro:run runs the kokoro jobs on a PR label Jul 18, 2018
@JoelPM
Copy link
Copy Markdown
Contributor Author

JoelPM commented Jul 18, 2018

Good point @dgageot, nit addressed.

@dgageot dgageot merged commit e9af7e5 into GoogleContainerTools:master Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants