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

Fix go.mod to be compatible with go1.13 #1297

Closed
wants to merge 2 commits into from

Conversation

zachbadgett
Copy link
Contributor

There was some concern related to using the replace directive in c6641fb; not sure I follow it completely.

Signed-off-by: Zach Badgett [email protected]

go.mod Outdated
@@ -56,7 +56,7 @@ require (
github.com/sirupsen/logrus v1.4.1
github.com/stretchr/testify v1.3.0
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2 // indirect
github.com/tonistiigi/fsutil v0.0.0-20190819224149-3d2716dd0a4d
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This commit had module related errors when resolving golang.org/x/crypto; updating fixes it, and the changes from 3d2716dd0a4d to 0f039a052ca1 seem to be fairly minor.

@thaJeztah
Copy link
Member

/cc @SamWhited

@SamWhited
Copy link
Member

There was some concern related to using the replace directive in c6641fb; not sure I follow it completely.

The issue with replace is that it's not transitive. Anything importing a package in the buildkit module would not see the replace directive, and would select a different version of containerd than the one required. Put another way: replace is for main packages, not for libraries.

go.mod Outdated
@@ -78,3 +78,5 @@ require (
replace github.com/hashicorp/go-immutable-radix => github.com/tonistiigi/go-immutable-radix v0.0.0-20170803185627-826af9ccf0fe

replace github.com/jaguilar/vt100 => github.com/tonistiigi/vt100 v0.0.0-20190402012908-ad4c4a574305

replace github.com/containerd/containerd v1.3.2 => github.com/containerd/containerd v0.0.0-20191014053712-acdcf13d5eaf
Copy link
Member

Choose a reason for hiding this comment

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

can we follow master?
#1293

@zachbadgett zachbadgett force-pushed the fix-go-mod branch 3 times, most recently from b38c32a to 9248464 Compare December 20, 2019 02:01
@zachbadgett
Copy link
Contributor Author

@SamWhited Thanks! That makes sense.

@AkihiroSuda I've made the same changes you made in yours, still works with go1.13 (tested with version 1.13.4). Travis failed at the "Cross" step, but I haven't been able to replicate any failures locally.

@GordonTheTurtle
Copy link
Collaborator

Please sign your commits following these rules:
https://github.com/moby/moby/blob/master/CONTRIBUTING.md#sign-your-work
The easiest way to do this is to amend the last commit:

$ git clone -b "fix-go-mod" [email protected]:zachbadgett/buildkit.git somewhere
$ cd somewhere
$ git rebase -i HEAD~842354378440
editor opens
change each 'pick' to 'edit'
save the file and quit
$ git commit --amend -s --no-edit
$ git rebase --continue # and repeat the amend for each commit
$ git push -f

Amending updates the existing PR. You DO NOT need to open a new one.

@zachbadgett
Copy link
Contributor Author

@AkihiroSuda Tracked down the issue, it was coming from the docker version you wanted to use. There were a couple dependency issues.

Issue 1:
From this commit: moby/moby@6b91cef docker moved to using osversion from github.com/Microsoft/hcsshim to get the windows OS version, however, osversion.Build() was not added until v0.8.7 in this commit: microsoft/hcsshim@92cb5b6 and buildkit was on v0.8.5.

Issue 2:
From this commit:
moby/moby@c3a0a37#diff-d56bbc14384133b2bc2cf0677bb3561bR105
Using windows.SecurityDescriptorFromString which was not added to sys until golang/sys@14da1ac#diff-c4ffa695b270239c949ef5b31be6c4f5R1317 and buildkit was on v0.0.0-20190812073006-9eafafc0a87e which did not include that change.

@thaJeztah
Copy link
Member

however, osversion.Build() was not added until v0.8.7 in this commit: microsoft/hcsshim@92cb5b6 and buildkit was on v0.8.5.

Be aware that tags should no longer be used from that repository. See microsoft/hcsshim#700

This is a code-only repository and does not have a stable release. 0.8.6 is the last tagged release, and it is out of date for ContainerD and Kubernetes. Downstream projects should vendor in this codebase using commit ids instead of tags, then validate fixes and do a full test pass of the whole project.

Unfortunately, go mod has no option for a repository to indicate "don't use tags" 😞

@zachbadgett
Copy link
Contributor Author

zachbadgett commented Dec 20, 2019

@thaJeztah buildkit does not have a direct dependency on microsoft/hcsshi. Only indirectly through docker and another library called fsutil (which uses v0.8.5); so using the tag that satisfies docker as well seems appropriate. Let me know if anyone disagrees or if anyone has a commit they would like me to switch to and I'll be happy to update it :)

@ghost
Copy link

ghost commented Jan 7, 2020

I have the same error when I want to import buildkit via go.mod

go: github.com/moby/[email protected] requires
	github.com/containerd/[email protected]: invalid pseudo-version: version before v1.3.0 would have negative patch number

Any plan to merge the fix ?

@AkihiroSuda
Copy link
Member

@tonistiigi @tiborvass @thaJeztah PTAL?

@AkihiroSuda AkihiroSuda mentioned this pull request Jan 14, 2020
8 tasks
@AkihiroSuda
Copy link
Member

@zachbadgett could you rebase and update the PR with replace directives?

@AkihiroSuda
Copy link
Member

sorry needs rebase again

@tonistiigi PTAL at replace directives?


replace github.com/containerd/containerd => github.com/containerd/containerd v1.3.1-0.20191217142032-9b5581cc9c5b

replace github.com/docker/docker => github.com/docker/docker v1.4.2-0.20191210192822-1347481b9eb5
Copy link
Collaborator

Choose a reason for hiding this comment

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

The versions used in these replace lines doesn't match the commit-hash used in the require list above.

@TBBle
Copy link
Collaborator

TBBle commented Jan 27, 2020

On the pseudo-version issues, is there any chance of the relevant upstream projects (containerd and docker, in this case) putting tags like v1.4.0-alpha.0 (in the case of containerd) on their master branch, on the commit after the previous release branched off?

(Without testing...) then go would pick those up, generate useful pseudo-versions, and we could avoid all the issues around replace in go.mod and having a higher-tagged-but-older version be selected for module resolution.

@thaJeztah
Copy link
Member

For containerd there's containerd/containerd#3031 and containerd/containerd#3554 tracking go mod compatibility.

@AkihiroSuda
Copy link
Member

needs rebase again

@AkihiroSuda
Copy link
Member

#24 [buildkitd 1/1] RUN --mount=target=. --mount=target=/root/.cache,type=ca...
#24 40.32 # github.com/moby/buildkit/solver/llbsolver/file
#24 40.32 solver/llbsolver/file/backend.go:29:29: undefined: "github.com/tonistiigi/fsutil/copy".User
#24 40.32 solver/llbsolver/file/backend.go:29:73: undefined: "github.com/tonistiigi/fsutil/copy".Chowner
#24 40.32 solver/llbsolver/file/backend.go:31:20: undefined: "github.com/tonistiigi/fsutil/copy".User
#24 40.32 solver/llbsolver/file/backend.go:36:12: undefined: "github.com/tonistiigi/fsutil/copy".User
#24 40.32 solver/llbsolver/file/backend.go:46:13: undefined: "github.com/tonistiigi/fsutil/copy".User
#24 40.32 solver/llbsolver/file/backend.go:68:76: undefined: "github.com/tonistiigi/fsutil/copy".User
#24 40.32 solver/llbsolver/file/backend.go:101:78: undefined: "github.com/tonistiigi/fsutil/copy".User
#24 40.32 solver/llbsolver/file/backend.go:163:81: undefined: "github.com/tonistiigi/fsutil/copy".User
#24 40.32 solver/llbsolver/file/unpack.go:15:95: undefined: "github.com/tonistiigi/fsutil/copy".Chowner
#24 40.32 solver/llbsolver/file/user_linux.go:15:63: undefined: "github.com/tonistiigi/fsutil/copy".User
#24 40.32 solver/llbsolver/file/backend.go:46:13: too many errors
#24 ERROR: executor failed running [/bin/sh -c go build -ldflags "$(cat /tmp/.ldflags) -w -extldflags -static" -tags "osusergo netgo static_build seccomp ${BUILDKITD_TAGS}" -o /usr/bin/buildkitd ./cmd/buildkitd &&   file /usr/bin/buildkitd | egrep "statically linked|Windows"]: buildkit-runc did not terminate sucessfully

@zachbadgett
Copy link
Contributor Author

My mistake, I thought I ran make test before committing.

go.mod Outdated
@@ -1,22 +1,20 @@
module github.com/moby/buildkit

go 1.12
go 1.11
Copy link
Member

Choose a reason for hiding this comment

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

why is this go1.11 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The change to go 1.12 must've been recent; I went over all the changes in the dependencies during rebase, however I missed the version metadata. I've updated it.

Signed-off-by: Zach Badgett <[email protected]>
@@ -4,19 +4,17 @@ go 1.12

require (
github.com/BurntSushi/toml v0.3.1
github.com/Microsoft/go-winio v0.4.14
github.com/Microsoft/hcsshim v0.8.5 // indirect
github.com/Microsoft/go-winio v0.4.15-0.20190919025122-fc70bd9a86b5
Copy link
Member

Choose a reason for hiding this comment

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

Where are these commits coming from? If I compare with containerd I don't see same commits. For some of them it isn't a big deal as if we have direct dependency we could bump it (although would be nice to mark it as upgrade in another commit then). But many in here seem to be just containerd dependencies. Or is it really that the old versions didn't build with go1.13?

@AkihiroSuda
Copy link
Member

@tonistiigi : Can we merge this as-is and address other issues in follow-up PRs?

@tonistiigi
Copy link
Member

tonistiigi commented Feb 19, 2020

@AkihiroSuda I'm fine with the replace rules but rolling back deps if they are already too new is going to be a pain. Feel free to carry this with extra commits to adjust containerd dependencies to the correct version to get this merged. And while you are at it, update to Dockerfile as well so we see this(and go.mod validation) in action.

@tonistiigi tonistiigi added this to the v0.7.0 milestone Feb 21, 2020
@tonistiigi tonistiigi mentioned this pull request Feb 25, 2020
@tonistiigi
Copy link
Member

carried in #1376

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.

7 participants