-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
check hashicorp: Add hashicorp whitelist (#279)
Signed-off-by: Or Shoval <[email protected]>
- Loading branch information
Showing
2 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |