Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

user: move userns package to separate module, and retract v0.2.0 #145

Merged
merged 1 commit into from
Aug 7, 2024
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
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ jobs:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v4
- if: ${{ matrix.go-version == '1.18.x' }}
run: |
# This corresponds with the list in Makefile:1, but omits the "userns"
# module, which requires go1.21 as minimum.
Comment on lines +19 to +20
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a comment here to relate it to the variable in the Makefile

echo 'PACKAGES="mountinfo mount sequential signal symlink user"' >> $GITHUB_ENV
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same list as Makefile:1, but minus userns, right? That's somewhat clear while reviewing this diff while they're close together, but will no longer be clear the minute we merge this. 😅 How do we make sure we remember to update this list in the future? (and know how to update it correctly?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, no good solution for that, honestly. Unless we probably introduce more complexity.

Overall, the risk is low;

  • if we don't update, the default is still all packages from the Makefile
  • if a new module is added that doesn't support go1.18, that module will thus fail
  • if we add a new module that should support go1.18, but we forgot to update; that module is skipped in the go1.18 tests (but still tested on current versions)

I'd consider only the last one slightly problematic, but perhaps a calculated risk, given that adding more modules should be a rare event 🙈

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

erm: middle bullet is obviously wrong; so only 1st and last apply 🤦‍♂️

- 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 # IMPORTANT: when updating this list, also update the conditional one in .github/workflows/test.yml
BINDIR ?= _build/bin
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And added a comment here as a reminder to check the one in the GitHub actions workflow when updating.

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.
Loading