Skip to content

Commit f8322b3

Browse files
aledbfclaude
andcommitted
build(release): ship licence notices with the binary and image
The Go CLI ports github.com/devcontainers/cli and carries its test fixtures and updateUID.Dockerfile, which are MIT (Copyright (c) Microsoft Corporation); NOTICE now keeps that notice. The modules the binary links (MIT, BSD, Apache) ask that their notice go with every copy, so task release:notices writes THIRD_PARTY_NOTICES from go-licenses (pinned in versions.yaml) plus Go's own licence, and the archives and the image ship LICENSE.txt, NOTICE and THIRD_PARTY_NOTICES. release:smoke fails a release without them. LICENSE.txt's copyright line names The spin-stack Authors, as the other spin-stack repositories will. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 1545861 commit f8322b3

8 files changed

Lines changed: 137 additions & 2 deletions

File tree

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ coverage.xml
88
.claude/
99
.task/
1010

11+
/THIRD_PARTY_NOTICES

‎.goreleaser.yml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ snapshot:
99
before:
1010
hooks:
1111
- go mod tidy
12+
# What archives: and dockers_v2: ship beside the binary: the licences of what it links.
13+
- go tool task release:notices
1214
# NOTE: `go test ./...` is intentionally NOT run here. It would sweep the
1315
# Docker/network parity suites and reference/node_modules. Gating lives in
1416
# the CI / tag workflow (.github/workflows/release.yml), not the release hook.
@@ -34,6 +36,11 @@ archives:
3436
- id: default
3537
formats: [tar.gz]
3638
name_template: "devcontainer_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
39+
# A copy of the binary carries the notices its licences and Microsoft's MIT ask for.
40+
files:
41+
- LICENSE.txt
42+
- NOTICE
43+
- THIRD_PARTY_NOTICES
3744

3845
checksum:
3946
name_template: "checksums.txt"
@@ -60,6 +67,10 @@ dockers_v2:
6067
ids:
6168
- devcontainer
6269
dockerfile: Dockerfile
70+
extra_files:
71+
- LICENSE.txt
72+
- NOTICE
73+
- THIRD_PARTY_NOTICES
6374
images:
6475
- ghcr.io/spin-stack/devcontainer-cli
6576
# Only the immutable, versioned tag here. `latest` is a moving tag, which is

‎Dockerfile‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,7 @@ LABEL org.opencontainers.image.revision="${REVISION}"
4343
USER nonroot:nonroot
4444

4545
COPY ${TARGETPLATFORM}/devcontainer /devcontainer
46+
# The image is a copy of the binary, so the notices its licences ask for go with it.
47+
COPY LICENSE.txt NOTICE THIRD_PARTY_NOTICES /usr/share/doc/devcontainer-cli/
4648

4749
ENTRYPOINT ["/devcontainer"]

‎LICENSE.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2026 spin-stack
189+
Copyright The spin-stack Authors
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

‎NOTICE‎

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
devcontainer-cli
2+
Copyright The spin-stack Authors
3+
4+
Licensed under the Apache License, Version 2.0; see LICENSE.txt.
5+
6+
This product is a Go implementation of the Dev Container CLI,
7+
https://github.com/devcontainers/cli, written to behave as that CLI does and
8+
validated against it. It contains material taken from that project, which is
9+
under the MIT License below:
10+
11+
- the test fixtures under src/test/configs/;
12+
- internal/docker/updateUID.Dockerfile, which the binary embeds;
13+
- the Go code that ports that CLI's behaviour (configuration merging,
14+
lifecycle order, Feature and Template handling, output and errors).
15+
16+
The Apache-2.0 licence does not take away the MIT notice below from that
17+
material: a copy of it, or of a substantial portion of it, carries the notice.
18+
19+
THIRD_PARTY_NOTICES, shipped beside the binary in a release, carries the
20+
licence of each Go module compiled into the binary.
21+
22+
--------------------------------------------------------------------------------
23+
github.com/devcontainers/cli
24+
--------------------------------------------------------------------------------
25+
26+
MIT License
27+
28+
Copyright (c) Microsoft Corporation.
29+
30+
Permission is hereby granted, free of charge, to any person obtaining
31+
a copy of this software and associated documentation files (the
32+
'Software'), to deal in the Software without restriction, including
33+
without limitation the rights to use, copy, modify, merge, publish,
34+
distribute, sublicense, and/or sell copies of the Software, and to
35+
permit persons to whom the Software is furnished to do so, subject to
36+
the following conditions:
37+
38+
The above copyright notice and this permission notice shall be
39+
included in all copies or substantial portions of the Software.
40+
41+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
42+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
43+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
44+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
45+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
46+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
47+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

‎Taskfile.yml‎

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ vars:
2424
COVER_DATA: artifacts/coverage/data
2525
# The image GoReleaser publishes (.goreleaser.yml's dockers), tagged with the version.
2626
IMAGE: ghcr.io/spin-stack/devcontainer-cli
27+
# What a release archive and the image carry beside the binary (.goreleaser.yml, Dockerfile).
28+
NOTICES: LICENSE.txt NOTICE THIRD_PARTY_NOTICES
2729

2830
tasks:
2931
default:
@@ -419,6 +421,28 @@ tasks:
419421
cmds:
420422
- echo "DISTROLESS_IMAGE=$(versions ref distroless)" >> "$GITHUB_ENV"
421423

424+
# The MIT, BSD and Apache licences of what the binary links ask that their notice go with every
425+
# copy, a compiled one too; GoReleaser runs this before it packs the archives and the image.
426+
release:notices:
427+
desc: Write THIRD_PARTY_NOTICES, the licence of Go and of each module compiled into the binary
428+
cmds:
429+
- |
430+
set -euo pipefail
431+
out=$(mktemp)
432+
trap 'rm -f "$out"' EXIT
433+
{
434+
printf '%s\n' "Third-party software compiled into the devcontainer binary, each with its licence." \
435+
"devcontainer-cli's own licence is LICENSE.txt; NOTICE names what it takes from github.com/devcontainers/cli."
436+
printf '\n%s\n%s\n%s\n\n' "================================================================================" \
437+
"Go standard library and runtime $(go env GOVERSION)" \
438+
"================================================================================"
439+
cat "$(go env GOROOT)/LICENSE"
440+
go run "github.com/google/go-licenses/v2@$(versions version go-licenses)" report ./cmd/devcontainer \
441+
--ignore {{.MODULE}} --template hack/third-party-notices.tmpl
442+
} > "$out"
443+
mv "$out" THIRD_PARTY_NOTICES
444+
trap - EXIT
445+
422446
# The release workflow's own steps. What only the workflow knows - the dispatch input, the
423447
# prepare job's outputs, the published digest - comes in the environment.
424448
release:resolve:
@@ -438,14 +462,43 @@ tasks:
438462
git push origin "$RELEASE_TAG"
439463
440464
release:smoke:
441-
desc: Check the published image of RELEASE_VERSION reports that version
465+
desc: Check the published image of RELEASE_VERSION reports that version, and it and dist's archives carry the licence notices
442466
cmds:
443467
- |
444468
set -euo pipefail
445469
IMAGE="{{.IMAGE}}:$RELEASE_VERSION"
446470
GOT="$(docker run --rm "$IMAGE" --version)"
447471
echo "image reported version: $GOT (expected: $RELEASE_VERSION)"
448472
test "$GOT" = "$RELEASE_VERSION"
473+
- task: release:smoke:archives
474+
- task: release:smoke:image-notices
475+
476+
release:smoke:archives:
477+
internal: true
478+
cmds:
479+
- |
480+
set -euo pipefail
481+
set -- dist/*.tar.gz
482+
test -e "$1" || { echo "no archive in dist/" >&2; exit 1; }
483+
for a in "$@"; do
484+
list=$(tar -tzf "$a")
485+
for f in {{.NOTICES}}; do
486+
grep -qx "$f" <<<"$list" || { echo "$a: no $f" >&2; exit 1; }
487+
done
488+
done
489+
490+
# The image has no shell, so the files are read from a created, never started, container.
491+
release:smoke:image-notices:
492+
internal: true
493+
cmds:
494+
- |
495+
set -euo pipefail
496+
IMAGE="{{.IMAGE}}:$RELEASE_VERSION"
497+
c=$(docker create "$IMAGE")
498+
trap 'docker rm -f "$c" >/dev/null' EXIT
499+
for f in {{.NOTICES}}; do
500+
docker cp "$c:/usr/share/doc/devcontainer-cli/$f" - | tar -t >/dev/null || { echo "$IMAGE: no $f" >&2; exit 1; }
501+
done
449502
450503
release:digest:
451504
desc: "Record the digest of the published image of RELEASE_VERSION (digest= to $GITHUB_OUTPUT, and the job summary)"

‎hack/third-party-notices.tmpl‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{{- /* go-licenses lists a module once per licence it finds in the file, so a module repeats when its file holds two; $prev prints each module's text once. */ -}}
2+
{{- $prev := "" -}}
3+
{{- range . -}}
4+
{{- if ne .Name $prev }}
5+
================================================================================
6+
{{ .Name }} {{ .Version }}
7+
================================================================================
8+
9+
{{ .LicenseText }}
10+
{{ end -}}
11+
{{- $prev = .Name -}}
12+
{{- end -}}

‎versions.yaml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,12 @@
4848
note: >-
4949
The Task `go tool task` runs (go-tools' cmd/task), for every platform a person or a runner
5050
works on: no repository compiles it.
51+
52+
- name: go-licenses
53+
kind: module
54+
source: github.com/google/go-licenses/v2
55+
version: v2.0.1
56+
track: github-release https://github.com/google/go-licenses
57+
note: >-
58+
task release:notices, which writes THIRD_PARTY_NOTICES for the release archives and image.
59+
A bump is checked by task release:notices and the archive listing of task release --snapshot.

0 commit comments

Comments
 (0)