Pass buildArgs to Kaniko#822
Pass buildArgs to Kaniko#822dgageot merged 4 commits intoGoogleContainerTools:masterfrom JoelPM:821_kaniko_build_args
Conversation
If buildArgs are present in skaffold.yaml for the Docker configuration, pass them through to kaniko. Addresses #821
|
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. What to do if you already signed the CLAIndividual signers
Corporate signers
|
|
CLA is signed. |
|
CLAs look good, thanks! |
pkg/skaffold/kaniko/kaniko.go
Outdated
|
|
||
| i := len(args) | ||
| for k, v := range artifact.DockerArtifact.BuildArgs { | ||
| withBuildArgs[i] = fmt.Sprintf("--build-arg=%s=%s", k, *v) |
There was a problem hiding this comment.
you can use append(args, fmt.Sprintf("--build-arg=%s=%s", k, *v)
There was a problem hiding this comment.
There was a problem hiding this comment.
Updated based on feedback. That's definitely cleaner.
|
@r2d4 - Made the changes you suggested, any other changes you'd like to see? |
pkg/skaffold/kaniko/kaniko.go
Outdated
| return args | ||
| } | ||
|
|
||
| if artifact.DockerArtifact.BuildArgs == nil || len(artifact.DockerArtifact.BuildArgs) == 0 { |
There was a problem hiding this comment.
Can be replaced with if len(artifact.DockerArtifact.BuildArgs) == 0
|
Good point @dgageot, nit addressed. |
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.