Skip to content

[24.0 backport] vendor: github.com/docker/distribution v2.8.3 - #46672

Closed
thaJeztah wants to merge 3 commits into
moby:24.0from
thaJeztah:24.0_backport_update_distribution_2.8.3
Closed

[24.0 backport] vendor: github.com/docker/distribution v2.8.3#46672
thaJeztah wants to merge 3 commits into
moby:24.0from
thaJeztah:24.0_backport_update_distribution_2.8.3

Conversation

@thaJeztah

@thaJeztah thaJeztah commented Oct 18, 2023

Copy link
Copy Markdown
Member

backports of;

Diff is different, because the 24.0 branch still uses the deprecated reference package, and doesn't contain;

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

This utility was setting the content-type header after WriteHeader was
called, and the header was not sent because of that.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit a9fcb77)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The test was depending on the client constructing an error based on the
http-status code, and the client not reading the response body if the
response was not a JSON response.

This fix;

- adds the correct content-type headers in the response
- includes error-messages in the response
- adds additional tests to cover both the plain (non-JSON) and JSON
  error responses, as well as an empty response.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 2c89640)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- Fix storageDriver gcs not registered in binaries
- reference: replace uses of deprecated function SplitHostname
- Dont parse errors as JSON unless Content-Type is set to JSON
- update to go1.20.8
- Set Content-Type header in registry client ReadFrom
- deprecate reference package, migrate to github.com/distribution/reference
- digestset: deprecate package in favor of go-digest/digestset
- Do not close HTTP request body in HTTP handler

full diff: distribution/distribution@v2.8.2...v2.8.3

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit e1d0aac)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah added this to the 24.0.7 milestone Oct 18, 2023
@thaJeztah thaJeztah changed the title 24.0 backport update distribution 2.8.3 [24.0 backport] vendor: github.com/docker/distribution v2.8.3 Oct 18, 2023
@thaJeztah

Copy link
Copy Markdown
Member Author

Interesting failures; they look like actual failures, but curious how the failures relate to these changes 🤔

failed to start daemon: insecure registry insecurehost.com:5000 is not valid: invalid host "insecurehost.com"
=== Failed
=== FAIL: daemon TestDaemonReloadAllowNondistributableArtifacts (0.00s)
    reload_test.go:71: allow-nondistributable-artifacts registry docker1.com is not valid: invalid host "docker1.com"

=== FAIL: daemon TestDaemonReloadInsecureRegistries (0.00s)
    reload_test.go:228: insecure registry docker1.example.com is not valid: invalid host "docker1.example.com"

=== FAIL: registry TestLoadAllowNondistributableArtifacts (0.00s)
    config_test.go:125: expect error 'allow-nondistributable-artifacts registry myregistry.example.com:500000 is not valid: invalid port "500000"', got 'allow-nondistributable-artifacts registry myregistry.example.com:500000 is not valid: invalid host "myregistry.example.com"'

=== FAIL: registry TestLoadInsecureRegistries (0.00s)
time="2023-10-18T16:01:47Z" level=warning msg="insecure registry http://myregistry.example.com should not contain 'http://' and 'http://' has been removed from the insecure registry config"
    config_test.go:244: expect no error, got 'insecure registry myregistry.example.com is not valid: invalid host "myregistry.example.com"'

=== FAIL: registry TestNewIndexInfo (0.00s)
    registry_test.go:421: insecure registry example.com is not valid: invalid host "example.com"

=== FAIL: registry TestAllowNondistributableArtifacts (0.00s)
    registry_test.go:660: allow-nondistributable-artifacts registry example.com is not valid: invalid host "example.com"
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x949aa5]

goroutine 199 [running]:
testing.tRunner.func1.2({0x9c0260, 0xef40a0})
	/usr/local/go/src/testing/testing.go:1526 +0x24e
testing.tRunner.func1()
	/usr/local/go/src/testing/testing.go:1529 +0x39f
panic({0x9c0260, 0xef40a0})
	/usr/local/go/src/runtime/panic.go:884 +0x213
github.com/docker/docker/registry.(*serviceConfig).allowNondistributableArtifacts(...)
	/go/src/github.com/docker/docker/registry/config.go:257
github.com/docker/docker/registry.TestAllowNondistributableArtifacts(0xc00036d520)
	/go/src/github.com/docker/docker/registry/registry_test.go:662 +0x705
testing.tRunner(0xc00036d520, 0xaa9370)
	/usr/local/go/src/testing/testing.go:1576 +0x10b
created by testing.(*T).Run
	/usr/local/go/src/testing/testing.go:1629 +0x3ea

DONE 2994 tests, 26 skipped, 6 failures in 312.017s
make: *** [Makefile:218: test-unit] Error 1
Error: Process completed with exit code 2.

@thaJeztah

Copy link
Copy Markdown
Member Author

🙈 😬 found it 😬 looks like I've been a victim of auto-complete in distribution;

var DomainRegexp = reference.DigestRegexp

@thaJeztah

Copy link
Copy Markdown
Member Author

closing; there's no plans to do more 24.0.x releases

@thaJeztah thaJeztah closed this Jun 8, 2024
@thaJeztah
thaJeztah deleted the 24.0_backport_update_distribution_2.8.3 branch June 8, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants