cisagov / cisagov/pre-commit-packer
feat: add `docker_image` based hooks?
- Dominant language
- Shell
- Stars
- 21
- Forks
- 16
- PR merge metrics
- No merged PRs in 30d
Description
# 💡 Summary #
Addition of `docker_image` based hooks for formatting and validating `packer` configs.
## Motivation and context ##
The current hooks require an installation of `packer` to work. Those who utilize Docker/Podman can more easily setup and run the hooks without a system install.
This would be useful because it removes the need for a `packer` installation and adds more cross-platform support.
## Implementation notes ##
An example hook config might look something like this:
```yaml
- description: |
Runs `packer fmt` on appropriate files inside a Docker.
entry: ghcr.io/cisagov/pre-commit-packer:latest /opt/pre-commit-packer/hooks/packer_fmt.sh
files: \.pkr(?:vars)?\.hcl$
id: packer_fmt_docker
language: docker_image
name: Packer Format (Docker)
```
It would require a `Dockerfile`, building an image with GitHub Actions and adding it to GHCR or some other registry.
## Acceptance criteria ##
- [ ] Current `script` based hooks continue to work as expected
- [ ] New hooks work allow easier usage for Docker/Podman users
Contributor guide
Assessment
This issue has not been assessed yet.