StyraInc / opa-aws-cloudformation-hook

AWS Cloudformation Hook for OPA-powered infrastructure policy enforcement
Apache License 2.0
35 stars 5 forks source link

Add workflow to generate hook zip file #41

Closed pauly4it closed 2 years ago

pauly4it commented 2 years ago

Description

Use GitHub actions to generate the pre-compiled zip file for the hook. Users can then upload the zip file to S3 and use it as the schema handler package input when registering the hook in their account.

Solves https://github.com/StyraInc/opa-aws-cloudformation-hook/issues/40: For users who do not have Docker Desktop installed locally due to licensing issues, the cfn submit command cannot be run with the default Docker flow. Disabling the Docker option in the hook configuration and building the zip file on a non-Linux system results in Lambda function errors. By running the cfn submit --dry-run command on an Ubuntu GitHub runner with Docker installed, we can ensure the hook package is correctly generated to run in Lambda.

Changes

Further Thoughts

Saving the zip file directly to the repo is not ideal, as it is nearly 90MB. We should instead move this process to use GitHub releases, however this solves an immediate pain point for non-Linux users without Docker Desktop.

pauly4it commented 2 years ago

@anderseknert got it, I'll make that change to mirror the OPA repo flow.

anderseknert commented 2 years ago

Looks like it worked ⭐️ https://github.com/StyraInc/opa-aws-cloudformation-hook/actions/runs/2795925581