-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Pass buildArgs to Kaniko #822
Pass buildArgs to Kaniko #822
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.
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)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
@r2d4 - Made the changes you suggested, any other changes you'd like to see? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks!!
There was a problem hiding this 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
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.
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
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.