Skip to content

Commit

Permalink
user: move userns package to separate module, and retract v0.2.0
Browse files Browse the repository at this point in the history
commit 86870e7 integrated the userns package
into the github.com/moby/sys/user module, which was included in the v0.2.0
version of the module.

Upon further discussion with maintainers, this may not have been a good
choice; the userns package is related to user-namespaces (uid/gid-mapping),
and while there are some tangential relations with "user", we shouldn't
conflate these concepts by putting both into the same module.

Some downstream projects (containerd, moby, containerd/cgroups) already
accepted patches to switch to the package that's part of the moby/sys/user
module, but none of those patches made it into a release.

This patch:

- moves the userns package to a separate module
- retracts the moby/sys/user v0.2.0 release
- downgrades the minimum go version update for the moby/sys/user module
  to go1.17. Note that CI is no longer testing go1.17, but go1.18 as minimum.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Aug 6, 2024
1 parent 86870e7 commit dda2929
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 13 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v4
- if: ${{ matrix.go-version == '1.18.x' }}
run: |
echo 'PACKAGES="mountinfo mount sequential signal symlink user"' >> $GITHUB_ENV
- name: go mod tidy
run: |
make tidy
Expand Down
18 changes: 6 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
PACKAGES ?= mountinfo mount sequential signal symlink user
PACKAGES ?= mountinfo mount sequential signal symlink user userns
BINDIR ?= _build/bin
CROSS ?= linux/arm linux/arm64 linux/ppc64le linux/s390x \
freebsd/amd64 openbsd/amd64 darwin/amd64 darwin/arm64 windows/amd64
Expand All @@ -16,18 +16,14 @@ clean:
test: test-local
set -eu; \
for p in $(PACKAGES); do \
if $p = user && go version | grep -qv go1.18; then \
(cd $$p; go test $(RUN_VIA_SUDO) -v .); \
fi \
(cd $$p; go test $(RUN_VIA_SUDO) -v .); \
done

.PHONY: tidy
tidy:
set -eu; \
for p in $(PACKAGES); do \
if $p = user && go version | grep -qv go1.18; then \
(cd $$p; go mod tidy); \
fi \
(cd $$p; go mod tidy); \
done

# Test the mount module against the local mountinfo source code instead of the
Expand All @@ -46,11 +42,9 @@ lint: $(BINDIR)/golangci-lint
$(BINDIR)/golangci-lint version
set -eu; \
for p in $(PACKAGES); do \
if $p = user && go version | grep -qv go1.18; then \
(cd $$p; \
go mod download; \
../$(BINDIR)/golangci-lint run); \
fi \
(cd $$p; \
go mod download; \
../$(BINDIR)/golangci-lint run); \
done

$(BINDIR)/golangci-lint: $(BINDIR)
Expand Down
4 changes: 3 additions & 1 deletion user/go.mod
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
module github.com/moby/sys/user

go 1.21
go 1.17

require golang.org/x/sys v0.1.0

retract v0.2.0 // Package github.com/moby/sys/user/userns was included in this module, but should've been a separate module; see https://github.com/moby/sys/pull/140#issuecomment-2250644304.
3 changes: 3 additions & 0 deletions userns/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/moby/sys/userns

go 1.21
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit dda2929

Please sign in to comment.