-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Build licenses.txt with trivy #35659
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
silverwind
wants to merge
9
commits into
go-gitea:main
Choose a base branch
from
silverwind:licnew
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+14
−1,658
Draft
Changes from 5 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
83044a0
Build licenses.txt with trivy
silverwind ead2fd0
clean
silverwind 819ae28
update comment
silverwind 79e3e3a
cleanup
silverwind 11bf95b
no need to pass LICENSES_FILE to webpack, remove excludeAssets option
silverwind b3567f2
move LICENSES_FILE as prereq to generate-go and watch-backend
silverwind 16013b9
use --scanners
silverwind 42e1c8f
unset GOEXPERIMENT when running trivy
silverwind 9cf1933
move it back to frontend targets
silverwind File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -37,11 +37,11 @@ GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected] | |
| MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/[email protected] | ||
| SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@717e3cb29becaaf00e56953556c6d80f8a01b286 | ||
| XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest | ||
| GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1 | ||
| GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1 | ||
| ACTIONLINT_PACKAGE ?= github.com/rhysd/actionlint/cmd/actionlint@v1 | ||
| GOPLS_PACKAGE ?= golang.org/x/tools/[email protected] | ||
| GOPLS_MODERNIZE_PACKAGE ?= golang.org/x/tools/gopls/internal/analysis/modernize/cmd/[email protected] | ||
| TRIVY_PACKAGE ?= github.com/aquasecurity/trivy/cmd/trivy@latest | ||
|
|
||
| DOCKER_IMAGE ?= gitea/gitea | ||
| DOCKER_TAG ?= latest | ||
|
|
@@ -149,19 +149,17 @@ BINDATA_DEST_WILDCARD := modules/migration/bindata.* modules/public/bindata.* mo | |
| GENERATED_GO_DEST := modules/charset/invisible_gen.go modules/charset/ambiguous_gen.go | ||
|
|
||
| SVG_DEST_DIR := public/assets/img/svg | ||
| LICENSES_FILE := public/assets/licenses.txt | ||
|
|
||
| AIR_TMP_DIR := .air | ||
|
|
||
| GO_LICENSE_TMP_DIR := .go-licenses | ||
| GO_LICENSE_FILE := assets/go-licenses.json | ||
|
|
||
| TAGS ?= | ||
| TAGS_SPLIT := $(subst $(COMMA), ,$(TAGS)) | ||
| TAGS_EVIDENCE := $(MAKE_EVIDENCE_DIR)/tags | ||
|
|
||
| TEST_TAGS ?= $(TAGS_SPLIT) sqlite sqlite_unlock_notify | ||
|
|
||
| TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(DIST) $(MAKE_EVIDENCE_DIR) $(AIR_TMP_DIR) $(GO_LICENSE_TMP_DIR) | ||
| TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(DIST) $(MAKE_EVIDENCE_DIR) $(AIR_TMP_DIR) | ||
|
|
||
| GO_DIRS := build cmd models modules routers services tests | ||
| WEB_DIRS := web_src/js web_src/css | ||
|
|
@@ -431,9 +429,9 @@ watch: ## watch everything and continuously rebuild | |
| @bash tools/watch.sh | ||
|
|
||
| .PHONY: watch-frontend | ||
| watch-frontend: node-check node_modules ## watch frontend files and continuously rebuild | ||
| watch-frontend: $(LICENSES_FILE) node-check node_modules ## watch frontend files and continuously rebuild | ||
| @rm -rf $(WEBPACK_DEST_ENTRIES) | ||
| NODE_ENV=development $(NODE_VARS) pnpm exec webpack --watch --progress --disable-interpret | ||
| @BROWSERSLIST_IGNORE_OLD_DATA=true NODE_ENV=development $(NODE_VARS) pnpm exec webpack --watch --progress --disable-interpret | ||
|
|
||
| .PHONY: watch-backend | ||
| watch-backend: go-check ## watch backend files and continuously rebuild | ||
|
|
@@ -483,30 +481,24 @@ unit-test-coverage: | |
| tidy: ## run go mod tidy | ||
| $(eval MIN_GO_VERSION := $(shell grep -Eo '^go\s+[0-9]+\.[0-9.]+' go.mod | cut -d' ' -f2)) | ||
| $(GO) mod tidy -compat=$(MIN_GO_VERSION) | ||
| @$(MAKE) --no-print-directory $(GO_LICENSE_FILE) | ||
|
|
||
| vendor: go.mod go.sum | ||
| $(GO) mod vendor | ||
| @touch vendor | ||
|
|
||
| .PHONY: tidy-check | ||
| tidy-check: tidy | ||
| @diff=$$(git diff --color=always go.mod go.sum $(GO_LICENSE_FILE)); \ | ||
| @diff=$$(git diff --color=always go.mod go.sum); \ | ||
| if [ -n "$$diff" ]; then \ | ||
| echo "Please run 'make tidy' and commit the result:"; \ | ||
| printf "%s" "$${diff}"; \ | ||
| exit 1; \ | ||
| fi | ||
|
|
||
| .PHONY: go-licenses | ||
| go-licenses: $(GO_LICENSE_FILE) ## regenerate go licenses | ||
| licenses: $(LICENSES_FILE) ## generate licenses.txt | ||
|
|
||
| $(GO_LICENSE_FILE): go.mod go.sum | ||
| @rm -rf $(GO_LICENSE_FILE) | ||
| $(GO) install $(GO_LICENSES_PACKAGE) | ||
| -GOOS=linux CGO_ENABLED=1 go-licenses save . --force --save_path=$(GO_LICENSE_TMP_DIR) 2>/dev/null | ||
| $(GO) run build/generate-go-licenses.go $(GO_LICENSE_TMP_DIR) $(GO_LICENSE_FILE) | ||
| @rm -rf $(GO_LICENSE_TMP_DIR) | ||
| $(LICENSES_FILE): go.sum pnpm-lock.yaml uv.lock | ||
| $(GO) run $(TRIVY_PACKAGE) fs --quiet --security-checks license --exit-code 0 --format spdx --output $(LICENSES_FILE) . | ||
|
|
||
| generate-ini-sqlite: | ||
| sed -e 's|{{REPO_TEST_DIR}}|${REPO_TEST_DIR}|g' \ | ||
|
|
@@ -848,11 +840,11 @@ deps-tools: ## install tool dependencies | |
| $(GO) install $(MISSPELL_PACKAGE) & \ | ||
| $(GO) install $(SWAGGER_PACKAGE) & \ | ||
| $(GO) install $(XGO_PACKAGE) & \ | ||
| $(GO) install $(GO_LICENSES_PACKAGE) & \ | ||
| $(GO) install $(GOVULNCHECK_PACKAGE) & \ | ||
| $(GO) install $(ACTIONLINT_PACKAGE) & \ | ||
| $(GO) install $(GOPLS_PACKAGE) & \ | ||
| $(GO) install $(GOPLS_MODERNIZE_PACKAGE) & \ | ||
| $(GO) install $(TRIVY_PACKAGE) & \ | ||
| wait | ||
|
|
||
| node_modules: pnpm-lock.yaml | ||
|
|
@@ -885,7 +877,7 @@ update-py: node-check | node_modules ## update py dependencies | |
| .PHONY: webpack | ||
| webpack: $(WEBPACK_DEST) ## build webpack files | ||
|
|
||
| $(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) pnpm-lock.yaml | ||
| $(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) $(LICENSES_FILE) pnpm-lock.yaml | ||
| @$(MAKE) -s node-check node_modules | ||
| @rm -rf $(WEBPACK_DEST_ENTRIES) | ||
| @echo "Running webpack..." | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.