check go licenses

This commit is contained in:
Willy Kloucek
2022-03-28 14:46:34 +02:00
parent 2ceb889c43
commit b646aace45
7 changed files with 1344 additions and 1 deletions

View File

@@ -41,6 +41,12 @@ $(CALENS): $(BINGO_DIR)/calens.mod
@echo "(re)installing $(GOBIN)/calens-v0.2.0"
@cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=calens.mod -o=$(GOBIN)/calens-v0.2.0 "github.com/restic/calens"
GO_LICENSES := $(GOBIN)/go-licenses-v1.0.1-0.20220228171150-d483853b331e
$(GO_LICENSES): $(BINGO_DIR)/go-licenses.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.
@echo "(re)installing $(GOBIN)/go-licenses-v1.0.1-0.20220228171150-d483853b331e"
@cd $(BINGO_DIR) && $(GO) build -mod=mod -modfile=go-licenses.mod -o=$(GOBIN)/go-licenses-v1.0.1-0.20220228171150-d483853b331e "github.com/google/go-licenses"
GOLANGCI_LINT := $(GOBIN)/golangci-lint-v1.43.0
$(GOLANGCI_LINT): $(BINGO_DIR)/golangci-lint.mod
@# Install binary/ries using Go 1.14+ build command. This is using bwplotka/bingo-controlled, separate go module with pinned dependencies.

5
.bingo/go-licenses.mod Normal file
View File

@@ -0,0 +1,5 @@
module _ // Auto generated by https://github.com/bwplotka/bingo. DO NOT EDIT
go 1.17
require github.com/google/go-licenses v1.0.1-0.20220228171150-d483853b331e

1286
.bingo/go-licenses.sum Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1 +1,3 @@
module _ // Fake go.mod auto-created by 'bingo' for go -moddir compatibility with non-Go projects. Commit this file, together with other .mod files.
module _ // Fake go.mod auto-created by 'bingo' for go -moddir compatibility with non-Go projects. Commit this file, together with other .mod files.
go 1.16

View File

@@ -16,6 +16,8 @@ BUILDIFIER="${GOBIN}/buildifier-v0.0.0-20211129135157-cdedcc0318b9"
CALENS="${GOBIN}/calens-v0.2.0"
GO_LICENSES="${GOBIN}/go-licenses-v1.0.1-0.20220228171150-d483853b331e"
GOLANGCI_LINT="${GOBIN}/golangci-lint-v1.43.0"
HUGO="${GOBIN}/hugo-v0.91.0"

View File

@@ -188,6 +188,7 @@ def main(ctx):
test_pipelines = \
cancelPreviousBuilds() + \
[goLicenseCheck(ctx)] + \
[buildOcisBinaryForTesting(ctx)] + \
testOcisModules(ctx) + \
testPipelines(ctx)
@@ -379,6 +380,37 @@ def buildOcisBinaryForTesting(ctx):
"volumes": [pipelineVolumeGo],
}
def goLicenseCheck(ctx):
return {
"kind": "pipeline",
"type": "docker",
"name": "go-license-check",
"platform": {
"os": "linux",
"arch": "amd64",
},
"steps": skipIfUnchanged(ctx, "acceptance-tests") +
makeNodeGenerate("") +
makeGoGenerate("") +
build() +
[{
"name": "check-go-license",
"image": OC_CI_GOLANG,
"commands": [
"make check-go-licenses",
],
"volumes": [stepVolumeGo],
}],
"trigger": {
"ref": [
"refs/heads/master",
"refs/tags/v*",
"refs/pull/**",
],
},
"volumes": [pipelineVolumeGo],
}
def uploadScanResults(ctx):
sonar_env = {
"SONAR_TOKEN": {

View File

@@ -174,6 +174,16 @@ protobuf:
bingo-update: $(BINGO)
$(BINGO) get -l -u
.PHONY: check-go-licenses
check-go-licenses: $(GO_LICENSES)
$(GO_LICENSES) check ./...
.PHONY: save-go-licenses
save-go-licenses: $(GO_LICENSES)
$(GO_LICENSES) csv ./... > ./licenses.csv
$(GO_LICENSES) save ./... --force --save_path="./licenses"
CHANGELOG_VERSION =
.PHONY: changelog