Skip to content

feat: add docker_image based hooks? #72

@jrdnbradford

Description

@jrdnbradford

💡 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:

- 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions