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

Enhancement of the Packer FMT + Packer Validate Hooks #4

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

schniber
Copy link

Enhancement of the Packer FMT + Packer Validate Hooks

🗣 Description

This PR enhances the following:
1- Packer fmt hook now not only checks but actually reformats all packer*.json or *.pkr.hcl. It also checks for *.pkrvars.hcl and if found formats them too.
2- Packer validate hook now accepts as input the *.pkrvars.hcl file which indicates to Packer with which parameters the Packer config can be validated with.

💭 Motivation and context

These enhancements are linked to the issue #3 I have created last week.

🧪 Testing

I have run tests on some packer configuration I am working on.
Additional details can be found on the README.md file that comes with this PR.

✅ Checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All future TODOs are captured in issues, which are referenced
    in code comments.
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All relevant repo and/or project documentation has been updated
    to reflect the changes in this PR.
  • Tests have been added and/or modified to cover the changes in this PR.
  • All new and existing tests pass.

Samuel CHNIBER added 2 commits March 30, 2021 20:40
@schniber schniber closed this Mar 30, 2021
@schniber schniber reopened this Mar 30, 2021
Copy link
Member

@mcdonnnj mcdonnnj left a comment

Choose a reason for hiding this comment

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

@schniber We use a skeleton system touched on in our development guide. This allows us to keep our linter and testing configurations consistent across all of our repos using cisagov/action-lineage.

Although your PR includes some useful functionality, in the process you have steamrolled everything else in this project. As an additional note here, packer fmt is only designed to service HCL2 configuration files as documented in the command help.

We would be happy to review a PR that adds the desired functionality, but we cannot accept a PR that intentionally creates discontinuity in one of our repositories.

@schniber
Copy link
Author

Hello @mcdonnnj
Thanks for your feedback.
I have aligned the PR to the contribution guidelines, sorry for that this is my first ever contribution :)
All checks seem to have passed now.

Regarding the pkrvars.hcl files, those are also considered as HCL2 files.
Unless I am mistaken, It looks like packers documentation is not up to date/or is unclear on this point.
Still, the packer fmt function works when you point it out to a .pkrvars.hcl file.
=> You can have a look to this merged PR for more details : hashicorp/packer#10377

Please feel free to revert back to me in case you need any additional details.

Looking forward to hearing from you.

Bests

@mcdonnnj mcdonnnj self-assigned this Mar 31, 2021
@mcdonnnj mcdonnnj added the improvement This issue or pull request will add or improve functionality, maintainability, or ease of use label Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

2 participants