Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Problem: Publications are not needed for Docker plugin #341

Merged
merged 1 commit into from
Apr 18, 2019

Conversation

dkliban
Copy link
Member

@dkliban dkliban commented Apr 16, 2019

Solution: Add 'repository_version' field to DockerDistribution

This patch allows users to create DockerDistributions that serve repository versions. A distribution can
be created with either a repository or repository version defined. If a repository is defined, the latest
version of that repository is always available at the distribution. If a repository version is specified,
then that repository version is always available at that distribution.

This patch updates an existing test and adds a new one. The two tests assert that a docker or podman pull
can be performed when a repository is used in a distribution and when a repository version is used.

This patch also fixes the tests to work with docker as the client.

closes: #4669
https://pulp.plan.io/issues/4669

@dkliban dkliban force-pushed the remove-publications branch 5 times, most recently from 02bec91 to 42203e7 Compare April 16, 2019 23:09
README.rst Show resolved Hide resolved
@ipanova
Copy link
Member

ipanova commented Apr 17, 2019

HTTP/1.1 400 Bad Request
Allow: GET, POST, DELETE, HEAD, OPTIONS
Connection: close
Content-Length: 61
Content-Type: application/json
Date: Wed, 17 Apr 2019 09:42:59 GMT
Server: gunicorn/19.9.0
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN

{
    "publisher": [
        "Publisher must be set if repository is set."
    ]
}

(pulp) [vagrant@pulp3-source-fedora29 pulp_rpm]$ http POST http://localhost:8000/pulp/api/v3/docker-distributions/ name='baz' base_path='foo' repository=/pulp/api/v3/repositories/b8c1211c-baef-456d-829e-1db5d5189976/versions/1/
HTTP/1.1 400 Bad Request
Allow: GET, POST, DELETE, HEAD, OPTIONS
Connection: close
Content-Length: 59
Content-Type: application/json
Date: Wed, 17 Apr 2019 09:43:16 GMT
Server: gunicorn/19.9.0
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN

{
    "repository": [
        "Invalid hyperlink - Incorrect URL match."
    ]
}

(pulp) [vagrant@pulp3-source-fedora29 pulp_rpm]$ http POST http://localhost:8000/pulp/api/v3/docker-distributions/ name='baz' base_path='foo' repository_version=/pulp/api/v3/repositories/b8c1211c-baef-456d-829e-1db5d5189976/versions/1/
HTTP/1.1 202 Accepted
Allow: GET, POST, DELETE, HEAD, OPTIONS
Connection: close
Content-Length: 67
Content-Type: application/json
Date: Wed, 17 Apr 2019 09:43:31 GMT
Server: gunicorn/19.9.0
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN

{
    "task": "/pulp/api/v3/tasks/f312b192-1ffd-42dc-860f-164ff88b5044/"
}

[vagrant@pulp3-source-fedora29 pulp_rpm]$ http POST http://localhost:8000/pulp/api/v3/docker-distributions/ name='bazz' base_path='foo1' repository_version=/pulp/api/v3/repositories/b8c1211c-baef-456d-829e-1db5d5189976/
HTTP/1.1 202 Accepted
Allow: GET, POST, DELETE, HEAD, OPTIONS
Connection: close
Content-Length: 67
Content-Type: application/json
Date: Wed, 17 Apr 2019 09:52:06 GMT
Server: gunicorn/19.9.0
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN

{
    "task": "/pulp/api/v3/tasks/ad492be8-b953-490e-9314-5f150ccfb946/"
}

@dkliban can you also reproduce this?

@ipanova
Copy link
Member

ipanova commented Apr 17, 2019

@dkliban also podman pull has issues

$ podman pull localhost:8080/foo1:latest --tls-verify=False
Trying to pull docker://localhost:8080/foo1:latest...Failed
(0x1840f00,0xc000411460)
Error: error pulling image "localhost:8080/foo1:latest": Invalid image name "localhost:8080/foo1:latest", unknown transport "localhost"

@dkliban
Copy link
Member Author

dkliban commented Apr 17, 2019

@ipanova The publisher validation code is coming from pulpcore. I updated the commit message to require pulp/pulpcore#93 but forgot to update the PR description. Please test again with both PRs.

@dkliban dkliban closed this Apr 17, 2019
@dkliban dkliban reopened this Apr 17, 2019
@dkliban
Copy link
Member Author

dkliban commented Apr 17, 2019

@ipanova When I tested earlier with docker, I ran into a problem where after the sync finished, not all ImageManifests were associated with the repository version. Then I got a 404 when trying to pull. However, after I cleaned out my DB and synced the repo again, I could not reproduce the problem and docker pull worked fine. I will try to reproduce again though.

@ipanova
Copy link
Member

ipanova commented Apr 17, 2019

@dkliban i will re-test with pulpcore PR, sorry i did not check the commit message

Solution: Add 'repository_version' field to DockerDistribution

This patch allows users to create DockerDistributions that serve repository versions. A distribution can
be created with either a repository or repository version defined. If a repository is defined, the latest
version of that repository is always available at the distribution. If a repository version is specified,
then that repository version is always available at that distribution.

This patch updates an existing test and adds a new one. The two tests assert that a docker or podman pull
can be performed when a repository is used in a distribution and when a repository version is used.

This patch also fixes the tests to work with docker as the client.

closes: #4669
https://pulp.plan.io/issues/4669
@dkliban
Copy link
Member Author

dkliban commented Apr 17, 2019

@ipanova I have fixed the problem with the repository_version not working. I've also added a test that checks that this works. I also updated the docs around Docker Distribution creation. I also made sure that the tests work when running on a system that only has docker installed and not podman. Please re-review.

@ipanova
Copy link
Member

ipanova commented Apr 18, 2019

i re-tested, repo_version works as well as pull of the content with a client. thank you!

@ipanova ipanova merged commit 565ae86 into pulp:master Apr 18, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants