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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃Ч Check licenses only, but not bundle them #376

Merged
merged 1 commit into from Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 2 additions & 14 deletions library.sh
Expand Up @@ -770,8 +770,8 @@ function __go_update_deps_for_module() {
remove_broken_symlinks ./vendor
fi

group "Updating licenses"
update_licenses third_party/VENDOR-LICENSE "./..."
group "Checking licenses"
check_licenses
cardil marked this conversation as resolved.
Show resolved Hide resolved
)
}

Expand Down Expand Up @@ -807,18 +807,6 @@ function run_kntest() {
go_run knative.dev/test-infra/tools/kntest/cmd/kntest@latest "$@"
}

# Run go-licenses to update licenses.
# Parameters: $1 - output file, relative to repo root dir.
# $2 - directory to inspect.
function update_licenses() {
local dst=$1
local dir=$2
shift
go_run github.com/google/go-licenses@v1.6.0 \
save "${dir}" --save_path="${dst}" --force || \
{ echo "--- FAIL: go-licenses failed to update licenses"; return 1; }
}

# Run go-licenses to check for forbidden licenses.
function check_licenses() {
# Check that we don't have any forbidden licenses.
Expand Down
5 changes: 2 additions & 3 deletions test/unit/update_deps_test.go
Expand Up @@ -22,12 +22,11 @@ func TestUpdateDeps(t *testing.T) {
contains("Golang module: knative.dev/hack/test"),
contains("Golang module: knative.dev/hack/schema"),
contains("Golang module: knative.dev/hack"),
contains("Updating licenses"),
contains("Checking licenses"),
contains("Removing unwanted vendor files"),
contains("go mod tidy"),
contains("go mod vendor"),
contains("go run github.com/google/go-licenses@v1.6.0 save ./... " +
"--save_path=third_party/VENDOR-LICENSE --force"),
contains("go run github.com/google/go-licenses@v1.6.0 check"),
},
}, {
name: "go_update_deps --upgrade",
Expand Down