Skip to content

Commit e8545c3

Browse files
committed
simplify handling of licenses
Currently, changes to dependencies usually trigger a corresponding need to run "make generate-go-licenses" to update the LICENSES file. The ultimate aim of this file is to track that the licenses we use are compliant with the policies we operate under (i.e. those of the CNCF). As such, the most important thing is tracking when licenses change. It isn't helpful for us to have to do busywork just to update the version number of a dependency in the LICENSES file; that mostly serves to break dependabot PRs and doesn't provide us with useful functionality. Instead, if we log out the module name and the license, we get the ability to track and audit licenses, providing a useful signal when a license changes or a new dependency is added that a maintainer should take a careful look at what changed to ensure compliance. Signed-off-by: Ashley Davis <ashley.davis@cyberark.com>
1 parent b7b26d5 commit e8545c3

2 files changed

Lines changed: 26 additions & 2 deletions

File tree

modules/licenses/01_mod.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ generate-go-licenses: #
3030
shared_generate_targets += generate-go-licenses
3131

3232
define licenses_target
33-
$1/LICENSES: $1/go.mod $(licenses_go_work) | $(NEEDS_GO-LICENSES)
33+
$1/LICENSES: $1/go.mod $(licenses_go_work) $(dir $(lastword $(MAKEFILE_LIST)))/licenses.tmpl | $(NEEDS_GO-LICENSES)
3434
cd $$(dir $$@) && \
3535
GOWORK=$(abspath $(licenses_go_work)) \
3636
GOOS=linux GOARCH=amd64 \
37-
$(GO-LICENSES) report --ignore "$$(license_ignore)" ./... > LICENSES
37+
$(GO-LICENSES) report --ignore "$$(license_ignore)" --template $(dir $(lastword $(MAKEFILE_LIST)))/licenses.tmpl ./... > LICENSES
3838

3939
generate-go-licenses: $1/LICENSES
4040
# The /LICENSE targets make sure these files exist.

modules/licenses/licenses.tmpl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
This LICENSES file is generated by the `licenses` module in makefile-modules.
2+
3+
The licenses below the "---" are determined by the go-licenses tool.
4+
5+
The aim of this file is to collect the licenses of all dependencies, and provide
6+
a single source of truth for licenses used by this project.
7+
8+
If CI reports that this file is out of date, you should be careful to check that the
9+
new licenses are acceptable for this project before running `make generate-go-licenses`
10+
to update this file.
11+
12+
Acceptable licenses are those allowlisted by the CNCF[0].
13+
14+
You MUST NOT add any new dependencies whose licenses are not allowlisted by the CNCF,
15+
or which do not have an explicit license exception[1].
16+
17+
[0]: https://github.com/cncf/foundation/blob/db4179134ebe7fa00b140a050c19147db808b6fa/policies-guidance/allowed-third-party-license-policy.md#cncf-allowlist-license-policy
18+
[1]: https://github.com/cncf/foundation/blob/db4179134ebe7fa00b140a050c19147db808b6fa/license-exceptions/README.md
19+
20+
---
21+
22+
{{ range . -}}
23+
{{ .Name }},{{ .LicenseName }}
24+
{{ end -}}

0 commit comments

Comments
 (0)