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

check hashicorp: Add hashicorp whitelist #105

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/check_hashicorp_modules.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Check HashiCorp Modules
on: [push, pull_request]
jobs:
check_modules:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Run script
run: ./hack/check_hashicorp.sh
24 changes: 24 additions & 0 deletions hack/check_hashicorp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

allowed_hashicorp_modules=(
"github.com/hashicorp/errwrap"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/hcl"
)

error_found=false
while read -r line; do
if ! [[ " ${allowed_hashicorp_modules[*]} " == *" $line "* ]]; then
echo "found non allowlisted hashicorp module: $line"
error_found=true
fi
done < <(grep -i hashicorp go.mod | grep -o 'github.com/[^ ]*')

if [[ $error_found == true ]]; then
echo "Non allowlisted hashicorp modules found, exiting with an error."
echo "HashiCorp adapted BSL, which we cant use on our projects."
echo "Please review the licensing, and either add it to the list if it isn't BSL,"
echo "or use a different library."
exit 1
fi
echo "All included hashicorp modules are allowlisted"