Skip to content

Commit 96fc174

Browse files
authored
check hashicorp: Add hashicorp whitelist (#279)
Signed-off-by: Or Shoval <[email protected]>
1 parent 0ed76c9 commit 96fc174

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Check HashiCorp Modules
2+
on: [push, pull_request]
3+
jobs:
4+
check_modules:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- name: Checkout code
8+
uses: actions/checkout@v2
9+
- name: Run script
10+
run: ./hack/check_hashicorp.sh

hack/check_hashicorp.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
allowed_hashicorp_modules=(
4+
"github.com/hashicorp/errwrap"
5+
"github.com/hashicorp/go-multierror"
6+
"github.com/hashicorp/hcl"
7+
)
8+
9+
error_found=false
10+
while read -r line; do
11+
if ! [[ " ${allowed_hashicorp_modules[*]} " == *" $line "* ]]; then
12+
echo "found non allowlisted hashicorp module: $line"
13+
error_found=true
14+
fi
15+
done < <(grep -i hashicorp go.mod | grep -o 'github.com/[^ ]*')
16+
17+
if [[ $error_found == true ]]; then
18+
echo "Non allowlisted hashicorp modules found, exiting with an error."
19+
echo "HashiCorp adapted BSL, which we cant use on our projects."
20+
echo "Please review the licensing, and either add it to the list if it isn't BSL,"
21+
echo "or use a different library."
22+
exit 1
23+
fi
24+
echo "All included hashicorp modules are allowlisted"

0 commit comments

Comments
 (0)