Skip to content

Dockerfile: update test-registry to v2.8.1 (latest release)#42889

Closed
thaJeztah wants to merge 2 commits intomoby:masterfrom
thaJeztah:update_test_registry
Closed

Dockerfile: update test-registry to v2.8.1 (latest release)#42889
thaJeztah wants to merge 2 commits intomoby:masterfrom
thaJeztah:update_test_registry

Conversation

@thaJeztah
Copy link
Member

@thaJeztah thaJeztah commented Sep 27, 2021

follow-up to #42881. Updating the version of the registry caused tests to fail, so moving it to a separate PR to dive into what's causing those failures (and if there's possibly an actual issue; either a bug or an issue in how we use the registry for testing)

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

@thaJeztah
Copy link
Member Author

Yup, looks to be failing on many tests. From the output of those tests, it seems the registry is not starting correctly, or somehow not listening on the expected port/ip

=== RUN   TestPluginInstall/no_auth
time="2021-09-27T12:34:19Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json"
time="2021-09-27T12:34:19Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:4b25d06088389b568a1412379bcd2818a63b14ec1a76056f61af72ac1df53c4b" mediatype=application/vnd.docker.plugin.v1+json size=522
time="2021-09-27T12:34:19Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json"
time="2021-09-27T12:34:19Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:4b25d06088389b568a1412379bcd2818a63b14ec1a76056f61af72ac1df53c4b" mediatype=application/vnd.docker.plugin.v1+json size=522
    plugin_test.go:77: assertion failed: error is not nil: error pushing plugin: error pushing plugin: failed to do request: Head "https://127.0.0.1:5000/v2/test-testplugininstall/no_auth/blobs/sha256:4b25d06088389b568a1412379bcd2818a63b14ec1a76056f61af72ac1df53c4b": dial tcp 127.0.0.1:5000: connect: connection refused
    --- FAIL: TestPluginInstall/no_auth (1.60s)

@tianon
Copy link
Member

tianon commented Nov 8, 2021

Can we reproduce locally? (I'm not at all familiar with these tests 🙈)

It would probably help to try and get logs from the registry instance to see what's going wrong. 😅

@thaJeztah thaJeztah force-pushed the update_test_registry branch from 74b6376 to c25d96f Compare February 18, 2022 00:55
@thaJeztah thaJeztah changed the title Dockerfile: update test-registry to v2.7.1 (latest release) Dockerfile: update test-registry to v2.8.0 (latest release) Feb 18, 2022
@thaJeztah
Copy link
Member Author

Rebased this one, and changed it to v2.8.0, which was now released. Lots of failures still, related to the `` mediatype:

=== RUN   TestPluginInstall/no_auth
time="2022-02-18T01:10:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json"
time="2022-02-18T01:10:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:6d9537ed87d8d0b2e437d8c92c4650c9aa78f0490dbb92d87394e0543a903195" mediatype=application/vnd.docker.plugin.v1+json size=522
time="2022-02-18T01:10:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json"
time="2022-02-18T01:10:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:6d9537ed87d8d0b2e437d8c92c4650c9aa78f0490dbb92d87394e0543a903195" mediatype=application/vnd.docker.plugin.v1+json size=522
    plugin_test.go:77: assertion failed: error is not nil: error pushing plugin: error pushing plugin: failed to do request: Head "https://127.0.0.1:5000/v2/test-testplugininstall/no_auth/blobs/sha256:e54fa740429f77dfb439821ebc805b26857e264962a926bd46a934a87f81c3d0": dial tcp 127.0.0.1:5000: connect: connection refused
    --- FAIL: TestPluginInstall/no_auth (1.53s)

I'm wondering why it's logging the same warning twice (but perhaps one of them was a HEAD or GET request?)

time="2022-02-18T01:10:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json"
time="2022-02-18T01:10:22Z" level=warning msg="reference for unknown type: application/vnd.docker.plugin.v1+json" digest="sha256:6d9537ed87d8d0b2e437d8c92c4650c9aa78f0490dbb92d87394e0543a903195" mediatype=application/vnd.docker.

That warning is coming from https://github.com/containerd/containerd/blob/v1.5.9/remotes/handlers.go#L73-L86, and it looks like that's all hard-coded (wondering if the containerd code should have a way to register custom mediaTypes)

However, those are "just" warnings? The actual error in the test above looks to be that we're unable to connect (or that the registry is refusing the plugin mediatype);

plugin_test.go:77: assertion failed: error is not nil: error pushing plugin: error pushing plugin: failed to do request: Head "https://127.0.0.1:5000/v2/test-testplugininstall/no_auth/blobs/sha256:e54fa740429f77dfb439821ebc805b26857e264962a926bd46a934a87f81c3d0": dial tcp 127.0.0.1:5000: connect: connection refused
--- FAIL: TestPluginInstall/no_auth (1.53s)

Looking at the 2.8.0 code; it looks like there's a concept of classes that can be allowed or denied https://github.com/distribution/distribution/blob/v2.8.0/registry/handlers/manifests.go#L432-L433

That option was added in v2.7 (through distribution/distribution@e02278f), but
gets configured through imh.App.Config.Policy.Repository.Classes. However if no classes are configured, it should not enforce those restrictions:
https://github.com/distribution/distribution/blob/v2.8.0/registry/handlers/manifests.go#L419-L422

Ok, so looks like further digging may be needed.

@thaJeztah
Copy link
Member Author

oh! just realised that registry 2.8.0 now comes in all architectures, so we no longer have to build it from source (can just COPY --from). Let me update the dockerfile for that as well

@thaJeztah
Copy link
Member Author

... and ... I guess I just noticed what may be related when looking at that;

        && git clone https://github.com/docker/distribution.git . \
        && git checkout -q "$REGISTRY_VERSION" \
        && GOPATH="/go/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
           go build -buildmode=pie -o /build/registry-v2 github.com/docker/distribution/cmd/registry \

The code was still assuming Godeps/_workspace 🤦 (curious that it still built something then?)

@thaJeztah thaJeztah force-pushed the update_test_registry branch 2 times, most recently from d926a08 to 0d33996 Compare February 18, 2022 22:45
@thaJeztah
Copy link
Member Author

Oh; I see I didn't post that yet, but stumbled upon a PR, (had a tab still open with it); Could this failure could have to do with #42210, which was done to handle a regression (see #42191), but I'm wondering if that's causing the "reverse" effect when using a newer registry (perhaps it no longer supports that type by default, but didn't dig into that yet)

@thaJeztah thaJeztah force-pushed the update_test_registry branch from 0d33996 to 15b89fb Compare March 10, 2022 21:41
@thaJeztah thaJeztah changed the title Dockerfile: update test-registry to v2.8.0 (latest release) Dockerfile: update test-registry to v2.8.1 (latest release) Mar 10, 2022

# REGISTRY_VERSION specifies the version of the registry to build and install
# from the https://github.com/docker/distribution repository. This version of
# the registry is used to test both schema 1 and schema 2 manifests. Generally,
Copy link
Member

Choose a reason for hiding this comment

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

This isn't totally accurate anymore, right? (There's a separate version used below for schema 1)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
The official registry 2.8.1 image now comes with all architectures that
we're interested in, so we can just copy the binary from that image instead
of building it from source:

    docker buildx imagetools inspect registry:2.8.1 | grep Platform
    Platform:  linux/amd64
    Platform:  linux/arm/v6
    Platform:  linux/arm/v7
    Platform:  linux/arm64/v8
    Platform:  linux/ppc64le
    Platform:  linux/s390x

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
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