Run kustomize build with kustomize localize and add a no-verify flag.
Context
Closes issue: https://github.com/kubernetes-sigs/kustomize/issues/5276
This PR adds functionality to auto-run kustomize build when the kustomize localize command is run. . This will run when --no-verify is not specified as false by the user or not specified at all when running the localize command. When the --no-verify flag is added, this check will be skipped.
🎩 Tophatted by doing:
make kustomize~/go/bin/kustomize localize . localized-results~/go/bin/kustomize localize . localized-results --no-verify~/go/bin/kustomize localize . localized-results --scope "/Desktop"
Questions for reviewers
- Does the way I approached this issue align with what was in mind when the original issue was created?
This PR has multiple commits, and the default merge method is: merge. You can request commits to be squashed using the label: tide/merge-method-squash
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: sanaasy / name: Sanaa Syed (37ff927b8d04c73726b85ddbbc9dce7530ffa90a, af17fb80986f1cb8b25568734baa862769b588bb, 70e1b710e50a118a74fa53e461810c86540ae7b6, facafce83865888b3c3898356c3f58cb3fb65af6, 3e0e54aca681d6d33293b4c7209aa7c578bb9ccb, 232004241028d23abe748d72b78f2759fa765958, 81503cbf7ef368a013f2f991837f465b5af951e6, b71c4d15b898180ae7298b3f5d669bdfc2d6128a, 2ccdf4e82918693cef1fa992652592724716d482, cdd73c1cf18def21f6a9fe8bc56deea5eae979c2)
Welcome @sanaasy!
It looks like this is your first PR to kubernetes-sigs/kustomize 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.
You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.
You can also check if kubernetes-sigs/kustomize has its own contribution guidelines.
You may want to refer to our testing guide if you run into trouble with your tests not passing.
If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!
Thank you, and welcome to Kubernetes. :smiley:
Hi @sanaasy. Thanks for your PR.
I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test label.
I understand the commands that are listed here.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
I'm still working on tests for this issue so keeping this in draft!
Edit: this is done!
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: christianh814, sanaasy Once this PR has been reviewed and has the lgtm label, please assign stormqueen1990 for approval. For more information see the Kubernetes Code Review Process.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
With regards to using exec.Command, I am not sure if I understand the reasoning for choosing it over invoking the build command function directly, since localize and build are relatively co-located in the codebase. Would you mind elaborating on that decision?
Sure! When I first wrote the code, I didn't see that the build command makeBuildCommand from the commands package was exported to be used anywhere in the code. I chose to exec this way to remove the dependency on building the command itself in the localize file and executing the Run command. If this is the preferred method though, I am happy to change it!
Sure! When I first wrote the code, I didn't see that the build command
makeBuildCommandfrom the commands package was exported to be used anywhere in the code. I chose to exec this way to remove the dependency on building the command itself in the localize file and executing the Run command. If this is the preferred method though, I am happy to change it!
Hi there, @sanaasy! Sorry for the delay in responding!
I have some concerns with the exec.Command() approach. Specifically, this approach requires the executable to be present in $PATH, and because it shells out to a separate command, it might be running build in a version that yields a result different from what the caller would yield.
The scenario I have in mind is something like this:
- I have a system-wide installation of Kustomize that exists under
/usr/bin/kustomize, which is at version v4.5.7. - I downloaded v5.3.0 to
/home/myuser/bin/kustomize. - I run
/home/myuser/bin/kustomize localize, expecting thatbuildwill also be run from this instance. - Instead,
kustomize localizeshells out to/usr/bin/kustomize(the$PATHinstallation), which could have a different API (and might yield a different result).
Please let me know if my understanding is incorrect, or if this scenario doesn't make sense!
I have some concerns with the exec.Command() approach. Specifically, this approach requires the executable to be present in $PATH, and because it shells out to a separate command, it might be running build in a version that yields a result different from what the caller would yield.
That's a fair callout! I have updated the PR to use the local build commands instead and have verified that things work as expected. If you could take another look please!
/test all
/label tide/merge-method-squash