You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
🐞 Engine 0.6.3 breaks docker publish for non OCI supporting registry #5433
We are on Artifactory and since the dagger engine v0.6.3 upgrade we can't push images to Artifactory. We are on Artifactory v6.x. Artifactory v7+ is supposed to support OCI images but I don't have a way to test. We don't have an upgrade planned in the near future so we won't be able to use new features of Dagger if non OCI supporting registries don't work with new Dagger versions.
Thanks for reporting and opening the issue @nipuna-perera!
For a general note, I think the fix here may just have to be adding an option to our APIs to force certain media types. I think the current behavior of using oci mediatypes is good default but need to give users a fallback for these types of cases.
Also, it would be cool if we could add compatibility tests similar to the ones I added here that test docker load against a range of dockerd versions
It would require the registry we're testing against can be run in a service container, but as long as that's doable those would be extremely helpful to catch regressions similar to this one going forward.
This doesn't seem to be fixed. I am still getting the same error after using the correct DockerMediaType. Upgraded to Go SDK 0.7.4 and engine 0.6.4 and added the additional option to the publish step.
Running artifactory container registry at version 6.23.25 via docker run --name artifactory -v /var/opt/jfrog/artifactory -d -p 8081:8081 -p 8082:8082 releases-docker.jfrog.io/jfrog/artifactory-jcr:6.23.25 (thank you to @marcosnils for figuring out the rest of the configuration setup!).
I can successfully publish to it in engine v0.6.0 through v0.6.2. Starting at v0.6.3 and above, I do indeed get this error: exporting to image ERROR: failed to push 127.0.0.1:8081/test/testimage:latest: failed commit on ref "manifest-sha256:83d558a4ce4181ea61bdaf9eceef236b0def48afb27a8bb03c475bedd9498308": unexpected status from PUT request to http://127.0.0.1:8081/v2/test/testimage/manifests/latest: 403 Forbidden
Which interestingly is a somewhat different error than @nipuna-perera has been getting, which is a plain 400 error rather than 403 failed commit on ref {ref}: unexpected status from PUT request to {image}: 400.
However, given the fact that it breaks on the exact same version, I'm inclined to think it's reasonably likely to be related if not the same thing, so will try out w/ specifying the mediatypes to docker in v0.6.4 and dig into what's different.
And was able to successfully publish to my local v6.23.25 artifactory container registry instance, but only when I set MediaTypes: dagger.Dockermediatypes, otherwise I'd get that 403 error mentioned above.
I know you said that you were including that setting too, so I'm not sure what the delta is here.
A few things to check and/or try:
How are you running the dagger-engine container? Is it just in your local docker installation? Or do you have a more custom deployment?
Are you using _EXPERIMENTAL_DAGGER_CLI_BIN at all? If so, worth making sure that is upgraded to v0.6.4 also as that would be required for the new setting to work
For an easy "random shot in the dark" attempt at a solution, you could try additionally including ForcedCompression: dagger.Gzip, in the dagger.ContainerPublishOpts.
I would be very surprised if this fixed it, but if somehow your engine's cache got layers that use a different compression than the default of gzip, it's possible you could end up including those in your publish attempts and maybe confuse the older version of artifactory. No clue how/why that would happen, but really easy to try so worth a shot I suppose.
When I do dagger run --debug I see the expected log output: [0.98s] publish(forcedCompression: "Gzip", mediaTypes: "DockerMediaTypes", address: "127.0.0.1:8081/test/testimage2:latest"), so something is still different...
I am on Linux, so I'll try on macos directly too since that's what you are using based on the version. No clue how that could be related, but will give it a shot anyways.
@nipuna-perera as another shot-in-the-dark, could you try running docker rm -fv dagger-engine-691afa1f6ab7b8d7, which should clear out your existing engine, and then re-run again? Just to double check there's not some stale cache state that could be (unexpectedly) interfering.
I can't run artifactory in docker desktop on macos for some reason (get a huge java stack trace at startup, cannot discern actual issue), but I can still use dagger run --debug and at least see this: [0.69s] ERROR publish(address: "127.0.0.1:8081/test/testimage2:latest", forcedCompression: "Gzip", mediaTypes: "DockerMediaTypes")
So the options are still what would be expected at least and different from what you are getting.... I need to think about what else could possibly be happening here, I'll get back to you when I have any other ideas. Sorry about the hassle here, something very bizarre seems to be happening.
I'm baffled, I see that you have forcedCompression in your log. It's not showing me that although I have it in my code.. So I don't think the MediaTypes are taken at all.. I tried go build, go install my binary and running. Same result with dagger run --debug
I only have a single Publish in my code, so I can't be running something un-intended.
I only have a single Publish in my code, so I can't be running something un-intended.
I know there's probably proprietary stuff you can't share, but is there anyway you could strip the proprietary parts out and send over the code you're running (can be DM on discord)? Just to make sure there's not some weird corner case where if Publish is called in some particular way it ends up ignoring options.
I figured it out @sipsma . I DID have another entrypoint for publish which I meant to remove a while back and my tests were using that. I am so sorry for taking so much of your valuable time on this! Thank you for sticking to it and helping me figure it out.
@nipuna-perera No worries at all! I'm just glad that it is working! Honestly the fact that this was so non-obvious probably means we need to improve our visibility+debuggability somewhere. If you have any suggestions on that front in the context of your code, please let us know!
Thank you @sipsma ! I think the project zenith work might help. If debug logging could output exact entrypoints to what it's running that may help debugging. But the code could have other strange endpoints the developer forgot to clean up. Those are tough to track for sure. If I think of anything else I will definitely let you know :)
Activity
sipsma commentedon Jul 12, 2023
Thanks for reporting and opening the issue @nipuna-perera!
For a general note, I think the fix here may just have to be adding an option to our APIs to force certain media types. I think the current behavior of using oci mediatypes is good default but need to give users a fallback for these types of cases.
Also, it would be cool if we could add compatibility tests similar to the ones I added here that test
docker loadagainst a range of dockerd versionsdagger/core/integration/container_test.go
Line 3917 in 8885634
It would require the registry we're testing against can be run in a service container, but as long as that's doable those would be extremely helpful to catch regressions similar to this one going forward.
nipuna-perera commentedon Jul 21, 2023
This doesn't seem to be fixed. I am still getting the same error after using the correct
DockerMediaType. Upgraded to Go SDK 0.7.4 and engine 0.6.4 and added the additional option to the publish step.gerhard commentedon Jul 25, 2023
Should we re-open this one @sipsma @marcosnils ?
sipsma commentedon Jul 25, 2023
Yes, I'm actually working on it right now
sipsma commentedon Jul 25, 2023
Running artifactory container registry at version
6.23.25viadocker run --name artifactory -v /var/opt/jfrog/artifactory -d -p 8081:8081 -p 8082:8082 releases-docker.jfrog.io/jfrog/artifactory-jcr:6.23.25(thank you to @marcosnils for figuring out the rest of the configuration setup!).I can successfully publish to it in engine v0.6.0 through v0.6.2. Starting at v0.6.3 and above, I do indeed get this error:
exporting to image ERROR: failed to push 127.0.0.1:8081/test/testimage:latest: failed commit on ref "manifest-sha256:83d558a4ce4181ea61bdaf9eceef236b0def48afb27a8bb03c475bedd9498308": unexpected status from PUT request to http://127.0.0.1:8081/v2/test/testimage/manifests/latest: 403 ForbiddenWhich interestingly is a somewhat different error than @nipuna-perera has been getting, which is a plain 400 error rather than 403
failed commit on ref {ref}: unexpected status from PUT request to {image}: 400.However, given the fact that it breaks on the exact same version, I'm inclined to think it's reasonably likely to be related if not the same thing, so will try out w/ specifying the mediatypes to docker in v0.6.4 and dig into what's different.
sipsma commentedon Jul 25, 2023
Okay so @nipuna-perera I just ran at
v0.6.4with this test code:And was able to successfully publish to my local
v6.23.25artifactory container registry instance, but only when I setMediaTypes: dagger.Dockermediatypes, otherwise I'd get that 403 error mentioned above.I know you said that you were including that setting too, so I'm not sure what the delta is here.
A few things to check and/or try:
_EXPERIMENTAL_DAGGER_CLI_BINat all? If so, worth making sure that is upgraded to v0.6.4 also as that would be required for the new setting to workForcedCompression: dagger.Gzip,in thedagger.ContainerPublishOpts.nipuna-perera commentedon Jul 25, 2023
Let me try that @sipsma . I am not using any experimental flags. Just vanilla dagger.
nipuna-perera commentedon Jul 25, 2023
using
dagger.Gzipdidn't work.I tried running
dagger run --debugand I see something interesting. this is my publish snippetBut in the log I see this
Why is it still "OCIMediaTypes"
I checked my
go.modwhich is using dagger v0.7.4. Anddocker psshows it running engine 0.6.4. My dagger CLI is also 0.6.4.sipsma commentedon Jul 25, 2023
@nipuna-perera Great find! That's definitely not expected. Just to double check, what's the output of running
dagger version?nipuna-perera commentedon Jul 25, 2023
sipsma commentedon Jul 25, 2023
When I do
dagger run --debugI see the expected log output:[0.98s] publish(forcedCompression: "Gzip", mediaTypes: "DockerMediaTypes", address: "127.0.0.1:8081/test/testimage2:latest"), so something is still different...I am on Linux, so I'll try on macos directly too since that's what you are using based on the version. No clue how that could be related, but will give it a shot anyways.
@nipuna-perera as another shot-in-the-dark, could you try running
docker rm -fv dagger-engine-691afa1f6ab7b8d7, which should clear out your existing engine, and then re-run again? Just to double check there's not some stale cache state that could be (unexpectedly) interfering.nipuna-perera commentedon Jul 25, 2023
Same result :(
sipsma commentedon Jul 25, 2023
I can't run artifactory in docker desktop on macos for some reason (get a huge java stack trace at startup, cannot discern actual issue), but I can still use
dagger run --debugand at least see this:[0.69s] ERROR publish(address: "127.0.0.1:8081/test/testimage2:latest", forcedCompression: "Gzip", mediaTypes: "DockerMediaTypes")So the options are still what would be expected at least and different from what you are getting.... I need to think about what else could possibly be happening here, I'll get back to you when I have any other ideas. Sorry about the hassle here, something very bizarre seems to be happening.
nipuna-perera commentedon Jul 25, 2023
I'm baffled, I see that you have
forcedCompressionin your log. It's not showing me that although I have it in my code.. So I don't think theMediaTypesare taken at all.. I triedgo build,go installmy binary and running. Same result withdagger run --debugI only have a single
Publishin my code, so I can't be running something un-intended.sipsma commentedon Jul 25, 2023
I know there's probably proprietary stuff you can't share, but is there anyway you could strip the proprietary parts out and send over the code you're running (can be DM on discord)? Just to make sure there's not some weird corner case where if
Publishis called in some particular way it ends up ignoring options.nipuna-perera commentedon Jul 25, 2023
Let me see if I can simplify it to a point which I can share. As it stands now it'll be tough to share context with my current code base.
nipuna-perera commentedon Jul 25, 2023
I figured it out @sipsma . I DID have another entrypoint for publish which I meant to remove a while back and my tests were using that. I am so sorry for taking so much of your valuable time on this! Thank you for sticking to it and helping me figure it out.
sipsma commentedon Jul 25, 2023
@nipuna-perera No worries at all! I'm just glad that it is working! Honestly the fact that this was so non-obvious probably means we need to improve our visibility+debuggability somewhere. If you have any suggestions on that front in the context of your code, please let us know!
nipuna-perera commentedon Jul 28, 2023
Thank you @sipsma ! I think the project zenith work might help. If debug logging could output exact entrypoints to what it's running that may help debugging. But the code could have other strange endpoints the developer forgot to clean up. Those are tough to track for sure. If I think of anything else I will definitely let you know :)