-
Notifications
You must be signed in to change notification settings - Fork 181
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
Usage as a Go library with Go modules #98
Comments
I don't think swapping over to Go modules will fix the issue directly, though it may trigger the issue which would make it more pressing. I think the answer lies in "Find a suitable, modern, Docker tag to depend on". I'm not sure what the community consensus is there so lets ask nice Docker maintainer folks: @thaJeztah, @vdemeester, @silvin-lubecki. |
The problem is that go modules enforce the use of SemVer; what happens on the docker/moby repository is that a) (as you mentioned) the moby repository has not tagged releases (releases are now tagged in the downstream docker/engine repository) While go mod can make sense for small repositories that provide a single package, it becomes quite problematic for repositories that provide a large number of packages (not all of which may follow the same "release cadence", so should be versioned independently). Things are still being discussed, but I think the current solution is to define a pseudo version in the go.mod (which must be higher than |
@garethr it looks like this is now fixed (thank you @olegsu and @thaJeztah!) Please verify when you have time. I used the following to test this out:
|
I've verified the set of commands above also work on Linux, running in official Go Docker container:
|
On first importing master into my module like so:
I ran into several build failures, due to the change in types mentioned above.
This comes down to a coupling between the docker package and the docker/cli package. In order to correctly use oras in another module you need to pin the cli version like so:
You can see this is specified here: https://github.com/deislabs/oras/blob/master/go.mod#L14 I previously had github.com/docker/cli v0.0.0-20190429053159-3273c2e23546. So things work, but I think it would be best to update the CLI package as well. |
Oras now supports go modules in master, so update to use that. Details in oras-project/oras#98
alright this should be fixed. @garethr, would you mind trying once again? |
@jdolitsky just checked this by updating cli and oras to the latest versions and everything works for me. Thanks! |
I'm relatively new to using Go modules, so some of this might be a little incorrect. A word of warning.
I wanted to use oras as a library, and successfully tried out the example provided in examples. I then wanted to recreate the functionality in oras which reuses the docker config to authenticate (in my case against an Azure registry. That led me to the code in the auth package.
In theory it should be enough to:
And then liberally copy the code from https://github.com/deislabs/oras/blob/master/cmd/oras/resolver.go#L22-L30.
In theory...
In practice this imports docker, which doesn't use tags on the repo to the
go mod
liking, which means you get an old version of Docker which imports logrus as with a capital letter "S" which causes the world to explode.I think that means Oras is using Docker v17.03.2-ce, which was shipped 2 years ago https://github.com/moby/moby/releases.
Some context for this issue sirupsen/logrus#451.
I've got this working by:
AuthConfig
type comes from in https://github.com/deislabs/oras/blob/master/pkg/auth/docker/resolver.go#L8I think the fix here is to:
dep
(this might be optional)At the moment anyone using Modules (recommended with 1.12) will run into this issue I think. It's possible this doesn't hit you if you're on macOS due to the case-incensitive filesystem, I've not tested that. The above was done on Linux.
The text was updated successfully, but these errors were encountered: