Skip to content

Add THIRD_PARTY_NOTICES.md and a generator for it - #1950

Merged
tariq1890 merged 1 commit into
NVIDIA:mainfrom
abrarshivani:third-party-notices
Aug 12, 2026
Merged

tariq1890 merged 1 commit into
NVIDIA:mainfrom
abrarshivani:third-party-notices

Conversation

@abrarshivani

@abrarshivani abrarshivani commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Adds THIRD_PARTY_NOTICES.md, listing every Go dep with the verbatim text of
its license, and the generator that produces it.

  • make third-party-notices regenerates it
  • make check-third-party-notices regenerates and diffs it, and runs on every build

Covers the modules linked into the four cmd/ binaries in the released image.

What to review

96% of the diff is generated. Hand-written:

File Lines
hack/generate-third-party-notices.sh 370
.github/workflows/third-party-notices-check.yaml 40
Makefile 16
.github/workflows/basic-checks.yaml 7
.gitignore 1
deployments/devel/tools.go 1

Generated: THIRD_PARTY_NOTICES.md (10966 lines), deployments/devel/go.mod
and go.sum (164).

How it works

  1. Use ./bin/go-licenses so the version pinned in deployments/devel/go.mod
    runs. tools.go gains the blank import so make install-tools and
    make -C deployments/devel check-modules keep that pin honest
  2. Check the platform list against deployments/container/multi-arch.mk, fail
    if out of sync, so a new image target cannot silently produce a short file
  3. Run go-licenses save and csv over ./cmd/... once per released platform,
    from vendor/, then merge. It resolves only the host platform, build-tagged
    sources differ per target, and there is no union mode
  4. Join all licenses per package instead of picking one
  5. Add module@version from vendor/modules.txt by longest-prefix match
  6. Write to a temp file, then move it into place

Implementation notes

  • CGO stays on. make cmds does not turn it off, and the released binaries
    link NVML through cgo. With CGO_ENABLED=0, build constraints exclude every
    file in github.com/NVIDIA/go-nvml/pkg/dl, and both go-licenses save and
    csv fail with build constraints exclude all Go files and exit 1, so the
    run stops rather than writing a short file. No C compiler is needed, since
    go-licenses only lists and parses.
  • Only the local module goes to --ignore. It matches raw string prefixes,
    not path segments. Passing the stdlib names adds the token go, which
    silently drops 15 of the 74 entries, including gRPC, protobuf, all of
    golang.org/x/* and all of gopkg.in/*, with a zero exit. Measured both
    ways.
  • Licenses are joined, not picked. go-licenses emits a row per recognised
    license, so keeping one would hide filepath-securejoin's MPL-2.0 behind its
    BSD-3-Clause.
  • Rows carry module@version, not a URL. In vendor mode go-licenses links
    into this repository at HEAD, which stops describing the released content
    once main advances and names this copy rather than upstream.
  • Output must match on every machine, since CI diffs it. LC_ALL=C on every
    sort and grep. Whole-line sort -u instead of by key, which BSD and GNU sort
    tie-break differently. The awk counts instead of using in, which mawk and
    BSD awk disagree on. grep -a so a NUL byte cannot change the fence width.
  • An unidentified license fails the run. go-licenses reports a license it
    cannot classify as Unknown and still exits 0, so without a guard the file
    would ship an entry that attributes nothing. Licenses are joined, so the check
    is anchored on both sides: it catches BSD-3-Clause / Unknown as well as a
    bare Unknown, and leaves one legitimately named Unknown-Something alone.
    An empty license field is caught too, since it would otherwise render as
    Unknown in the document.
  • Moved into place with mv, not cp. cp truncates the target first, so
    an interrupted run would leave a half-written file.

Scope

./cmd/... is what make cmds builds: CMDS is a wildcard over ./cmd/*, and
the Dockerfile runs make PREFIX=/artifacts cmds then copies all four binaries
into the image. Against ./... the only extra is the local
internal/resource/testing helper, which brings in no third-party dep.

Not covered:

  • The build tools in deployments/devel. They are not redistributed, so they
    carry no attribution obligation.
  • The distroless base image, covered by that image's own compliance process. The
    preamble links to its OSS listing.
  • The static BusyBox binary and its applet symlinks, handled separately,
    including any source-distribution obligations it carries. The preamble records
    that it is GPLv2.
  • The e2e suite under tests/, a separate module with its own go.mod and
    vendor tree, so its deps cannot reach this graph.

Shipping

Committed to the repository. Not copied into the image, so image size is
unchanged, and not attached to releases, so the release flow is untouched.

make check-third-party-notices runs on every build, not behind a changed-paths
filter. The list is the import set of ./cmd/..., so it goes stale when an
ordinary .go file changes its imports, not only when go.mod or vendor/
move. A filter keyed on manifests would pass green and the failure would land on
main instead of the PR that caused it.

Testing

  • Same sha256 on macOS/arm64 (BSD awk, BSD sort) and in golang:1.26.5 (mawk
    1.3.4, GNU coreutils):
    c401458af84d245cf45a0f438a9899a3e9e97f88c43316dbf683386bc9756d2a. Two runs
    on one host also match.
  • Completeness, derived without go-licenses: go list -deps ./cmd/... on
    linux/amd64 and linux/arm64 gives 513 non-stdlib, non-local packages,
    mapped by longest prefix to 74 license dirs in vendor/. Expected 74, present
    74, 0 missing, 0 extra.
  • 74 index rows, 74 license-text sections, one per row and none orphaned.
  • 0 Unknown licenses, 0 "License text unavailable", 0 unresolved
    module@version.
  • The three multi-licensed entries (filepath-securejoin, sigs.k8s.io/json,
    sigs.k8s.io/yaml) match the files in vendor/.
  • make check-third-party-notices passes on the committed file, and fails with
    a clear message when it is stale and when it is untracked. The
    basic / third-party-notices job passes here.
  • Error paths: missing multi-arch.mk or vendor/modules.txt, a platform
    matrix out of sync, a filesystem replace directive, an unreadable module
    list. Each fails with a specific message and a non-zero exit.
  • make -C deployments/devel check-modules passes.
  • shellcheck clean on hack/generate-third-party-notices.sh. actionlint and
    yamllint report nothing on the new and changed workflows.

@abrarshivani
abrarshivani marked this pull request as ready for review August 7, 2026 22:03
@abrarshivani abrarshivani self-assigned this Aug 7, 2026
Comment thread hack/generate-notices.sh Resolved
Comment thread .github/workflows/basic-checks.yaml Resolved
Comment thread hack/create-release.sh Resolved
Comment thread .gitignore Resolved
Comment thread Makefile Resolved
Comment thread Makefile Resolved
Comment thread Makefile Resolved
Comment thread Makefile Resolved
Comment thread hack/create-release.sh Resolved
Comment thread .github/workflows/notices-check.yaml Resolved
@abrarshivani
abrarshivani force-pushed the third-party-notices branch 6 times, most recently from 411981a to e507275 Compare August 11, 2026 23:26
Comment thread hack/generate-notices.sh Resolved
Comment thread hack/generate-notices.sh Resolved
Comment thread hack/generate-notices.sh Resolved
Comment thread hack/generate-notices.sh Resolved
Co-authored-by: Tariq <tariq181290@gmail.com>
Signed-off-by: Abrar Shivani <ashivani@nvidia.com>
@tariq1890

Copy link
Copy Markdown
Contributor

The description still says this

Covers two surfaces: the modules linked into the four cmd/ binaries in the
released image, and the build tools pinned in deployments/devel.

I am assuming this is just outdated?

@abrarshivani

Copy link
Copy Markdown
Contributor Author

@tariq1890 Yes this is outdated as following from deployments/devel are not shipped.

	github.com/google/go-licenses/v2 v2.0.1
	github.com/matryer/moq v0.7.1

@tariq1890
tariq1890 merged commit b451042 into NVIDIA:main Aug 12, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants