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

Pass arguments to Packer #37

Merged
merged 2 commits into from
Sep 10, 2024
Merged

Conversation

mcdonnnj
Copy link
Member

@mcdonnnj mcdonnnj commented Sep 10, 2024

🗣 Description

This pull request adds naive argument pass-through for the packer_fmt and packer_validate hooks.

Warning

This naive approach will not differentiate file paths that begin with a - from arguments. However, when testing a workaround I found that a lot of hooks also do not like paths that begin with a -.

💭 Motivation and context

This will allow consumers of the hook to pass options through to the underlying Packer calls. It will also allow one to override the current default behavior of the packer_fmt hook to only check and not write changes to files. Note that this effectively replaces #13 and #25 by allowing a consumer of the hook to set their own arguments.

🧪 Testing

Automated tests pass. This worked as expected when I tested it locally.

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All new and existing tests pass.

This just pulls Packer arguments out to separate them from the files
that are passed in by pre-commit. Note that this is a minimal effort
implementation so arguments with values should use the `-arg=value`
form.

This also breaks the `-check` argument out into the overwritable `args`
value for the hook.
This just pulls Packer arguments out to separate them from the files
that are passed in by pre-commit. Note that this is a minimal effort
implementation so arguments with values should use the `-arg=value`
form.
@mcdonnnj mcdonnnj added breaking change This issue or pull request involves changes to existing functionality improvement This issue or pull request will add or improve functionality, maintainability, or ease of use labels Sep 10, 2024
@mcdonnnj mcdonnnj requested a review from a team September 10, 2024 21:14
@mcdonnnj mcdonnnj self-assigned this Sep 10, 2024
@mcdonnnj mcdonnnj merged commit c49bdd1 into develop Sep 10, 2024
4 checks passed
@mcdonnnj mcdonnnj deleted the improvement/pass_arguments_to_packer branch September 10, 2024 21:50
@mcdonnnj mcdonnnj mentioned this pull request Sep 12, 2024
6 tasks
@mcdonnnj mcdonnnj linked an issue Oct 16, 2024 that may be closed by this pull request
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change This issue or pull request involves changes to existing functionality improvement This issue or pull request will add or improve functionality, maintainability, or ease of use
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide argument pass-through to packer in the hooks
3 participants