Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ coverage.xml
.claude/
.task/

/THIRD_PARTY_NOTICES
11 changes: 11 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ snapshot:
before:
hooks:
- go mod tidy
# What archives: and dockers_v2: ship beside the binary: the licences of what it links.
- go tool task release:notices
# NOTE: `go test ./...` is intentionally NOT run here. It would sweep the
# Docker/network parity suites and reference/node_modules. Gating lives in
# the CI / tag workflow (.github/workflows/release.yml), not the release hook.
Expand All @@ -34,6 +36,11 @@ archives:
- id: default
formats: [tar.gz]
name_template: "devcontainer_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
# A copy of the binary carries the notices its licences and Microsoft's MIT ask for.
files:
- LICENSE.txt
- NOTICE
- THIRD_PARTY_NOTICES

checksum:
name_template: "checksums.txt"
Expand All @@ -60,6 +67,10 @@ dockers_v2:
ids:
- devcontainer
dockerfile: Dockerfile
extra_files:
- LICENSE.txt
- NOTICE
- THIRD_PARTY_NOTICES
images:
- ghcr.io/spin-stack/devcontainer-cli
# Only the immutable, versioned tag here. `latest` is a moving tag, which is
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,7 @@ LABEL org.opencontainers.image.revision="${REVISION}"
USER nonroot:nonroot

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

ENTRYPOINT ["/devcontainer"]
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright 2026 spin-stack
Copyright The spin-stack Authors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
47 changes: 47 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
devcontainer-cli
Copyright The spin-stack Authors

Licensed under the Apache License, Version 2.0; see LICENSE.txt.

This product is a Go implementation of the Dev Container CLI,
https://github.com/devcontainers/cli, written to behave as that CLI does and
validated against it. It contains material taken from that project, which is
under the MIT License below:

- the test fixtures under src/test/configs/;
- internal/docker/updateUID.Dockerfile, which the binary embeds;
- the Go code that ports that CLI's behaviour (configuration merging,
lifecycle order, Feature and Template handling, output and errors).

The Apache-2.0 licence does not take away the MIT notice below from that
material: a copy of it, or of a substantial portion of it, carries the notice.

THIRD_PARTY_NOTICES, shipped beside the binary in a release, carries the
licence of each Go module compiled into the binary.

--------------------------------------------------------------------------------
github.com/devcontainers/cli
--------------------------------------------------------------------------------

MIT License

Copyright (c) Microsoft Corporation.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
55 changes: 54 additions & 1 deletion Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ vars:
COVER_DATA: artifacts/coverage/data
# The image GoReleaser publishes (.goreleaser.yml's dockers), tagged with the version.
IMAGE: ghcr.io/spin-stack/devcontainer-cli
# What a release archive and the image carry beside the binary (.goreleaser.yml, Dockerfile).
NOTICES: LICENSE.txt NOTICE THIRD_PARTY_NOTICES

tasks:
default:
Expand Down Expand Up @@ -419,6 +421,28 @@ tasks:
cmds:
- echo "DISTROLESS_IMAGE=$(versions ref distroless)" >> "$GITHUB_ENV"

# The MIT, BSD and Apache licences of what the binary links ask that their notice go with every
# copy, a compiled one too; GoReleaser runs this before it packs the archives and the image.
release:notices:
desc: Write THIRD_PARTY_NOTICES, the licence of Go and of each module compiled into the binary
cmds:
- |
set -euo pipefail
out=$(mktemp)
trap 'rm -f "$out"' EXIT
{
printf '%s\n' "Third-party software compiled into the devcontainer binary, each with its licence." \
"devcontainer-cli's own licence is LICENSE.txt; NOTICE names what it takes from github.com/devcontainers/cli."
printf '\n%s\n%s\n%s\n\n' "================================================================================" \
"Go standard library and runtime $(go env GOVERSION)" \
"================================================================================"
cat "$(go env GOROOT)/LICENSE"
go run "github.com/google/go-licenses/v2@$(versions version go-licenses)" report ./cmd/devcontainer \
--ignore {{.MODULE}} --template hack/third-party-notices.tmpl
} > "$out"
mv "$out" THIRD_PARTY_NOTICES
trap - EXIT

# The release workflow's own steps. What only the workflow knows - the dispatch input, the
# prepare job's outputs, the published digest - comes in the environment.
release:resolve:
Expand All @@ -438,14 +462,43 @@ tasks:
git push origin "$RELEASE_TAG"

release:smoke:
desc: Check the published image of RELEASE_VERSION reports that version
desc: Check the published image of RELEASE_VERSION reports that version, and it and dist's archives carry the licence notices
cmds:
- |
set -euo pipefail
IMAGE="{{.IMAGE}}:$RELEASE_VERSION"
GOT="$(docker run --rm "$IMAGE" --version)"
echo "image reported version: $GOT (expected: $RELEASE_VERSION)"
test "$GOT" = "$RELEASE_VERSION"
- task: release:smoke:archives
- task: release:smoke:image-notices

release:smoke:archives:
internal: true
cmds:
- |
set -euo pipefail
set -- dist/*.tar.gz
test -e "$1" || { echo "no archive in dist/" >&2; exit 1; }
for a in "$@"; do
list=$(tar -tzf "$a")
for f in {{.NOTICES}}; do
grep -qx "$f" <<<"$list" || { echo "$a: no $f" >&2; exit 1; }
done
done

# The image has no shell, so the files are read from a created, never started, container.
release:smoke:image-notices:
internal: true
cmds:
- |
set -euo pipefail
IMAGE="{{.IMAGE}}:$RELEASE_VERSION"
c=$(docker create "$IMAGE")
trap 'docker rm -f "$c" >/dev/null' EXIT
for f in {{.NOTICES}}; do
docker cp "$c:/usr/share/doc/devcontainer-cli/$f" - | tar -t >/dev/null || { echo "$IMAGE: no $f" >&2; exit 1; }
done

release:digest:
desc: "Record the digest of the published image of RELEASE_VERSION (digest= to $GITHUB_OUTPUT, and the job summary)"
Expand Down
12 changes: 12 additions & 0 deletions hack/third-party-notices.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{{- /* 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. */ -}}
{{- $prev := "" -}}
{{- range . -}}
{{- if ne .Name $prev }}
================================================================================
{{ .Name }} {{ .Version }}
================================================================================

{{ .LicenseText }}
{{ end -}}
{{- $prev = .Name -}}
{{- end -}}
9 changes: 9 additions & 0 deletions versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,12 @@
note: >-
The Task `go tool task` runs (go-tools' cmd/task), for every platform a person or a runner
works on: no repository compiles it.

- name: go-licenses
kind: module
source: github.com/google/go-licenses/v2
version: v2.0.1
track: github-release https://github.com/google/go-licenses
note: >-
task release:notices, which writes THIRD_PARTY_NOTICES for the release archives and image.
A bump is checked by task release:notices and the archive listing of task release --snapshot.
Loading