Skip to content

Commit

Permalink
modules: Amend hashicorp filtering (#1607)
Browse files Browse the repository at this point in the history
* go mod: Improve readability

The go VER line was there, but not in the beginning as it should.

Signed-off-by: Or Shoval <[email protected]>

* modules: Amend hashicorp filtering

According cncf/foundation#617 (comment)
we need to look on go.mod only because we have "go 1.17" in go.mod.
Adapt git actions accordingly.

Signed-off-by: Or Shoval <[email protected]>

---------

Signed-off-by: Or Shoval <[email protected]>
  • Loading branch information
oshoval authored Sep 19, 2023
1 parent a17a572 commit 84ad96e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 27 deletions.
30 changes: 5 additions & 25 deletions .github/workflows/check_hashicorp_modules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,18 @@ jobs:
- name: Run script
run: |
allowed_hashicorp_modules=(
"github.com/hashicorp/consul/api"
"github.com/hashicorp/consul/sdk"
"github.com/hashicorp/errwrap"
"github.com/hashicorp/hcl"
"github.com/hashicorp/logutils"
"github.com/hashicorp/mdns"
"github.com/hashicorp/memberlist"
"github.com/hashicorp/serf"
"github.com/hashicorp/go-cleanhttp"
"github.com/hashicorp/go-immutable-radix"
"github.com/hashicorp/golang-lru"
"github.com/hashicorp/go-msgpack"
"github.com/hashicorp/go-multierror"
"github.com/hashicorp/go.net"
"github.com/hashicorp/go-retryablehttp"
"github.com/hashicorp/go-rootcerts"
"github.com/hashicorp/go-sockaddr"
"github.com/hashicorp/go-syslog"
"github.com/hashicorp/go-uuid"
"github.com/hashicorp/go-version"
"github.com/hashicorp/hcl"
)
error_found=false
while read -r line; do
module=$(echo "$line" | cut -d ' ' -f 1)
if [[ $module == github.com/hashicorp/* ]]; then
if ! [[ " ${allowed_hashicorp_modules[*]} " == *" $module "* ]]; then
echo "found non allowlisted hashicorp module: $module"
error_found=true
fi
if ! [[ " ${allowed_hashicorp_modules[*]} " == *" $line "* ]]; then
echo "found non allowlisted hashicorp module: $line"
error_found=true
fi
done < go.sum
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."
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module github.com/kubevirt/cluster-network-addons-operator

go 1.17

require (
github.com/Masterminds/sprig v2.22.0+incompatible
github.com/blang/semver v3.5.1+incompatible
Expand Down Expand Up @@ -332,5 +334,3 @@ replace github.com/Microsoft/go-winio => github.com/Microsoft/go-winio v0.4.17
replace bitbucket.org/ww/goautoneg => github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d

replace github.com/Masterminds/goutils => github.com/Masterminds/goutils v1.1.1

go 1.17

0 comments on commit 84ad96e

Please sign in to comment.