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

Sync v1 and v2 content when the registry support it. #119

Merged
merged 1 commit into from Feb 1, 2016

Conversation

bowlofeggs
Copy link
Contributor

pulp-docker used to try v2 and fall back to v1 if v2 was not
supported. This commit causes pulp-docker to sync both for
registries that support them.

https://pulp.plan.io/issues/1449

re #1449


v2_found = self.index_repository.api_version_check()
v1_found = self.v1_index_repository.api_version_check()
# TODO: REMOVE THIS
Copy link
Contributor

Choose a reason for hiding this comment

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

@rbarlow remove this :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Austin wrote:

@rbarlow https://github.com/rbarlow remove this :)

my brain is running low on thinking from doing too much work. Fixed.

Randy Barlow
irc: bowlofeggs

pulp-docker used to try v2 and fall back to v1 if v2 was not
supported. This commit causes pulp-docker to sync both for
registries that support them.

https://pulp.plan.io/issues/1449

re #1449
working_dir=working_dir))
if v1_found:
_logger.debug(_('v1 API found'))
self.add_child(v1_sync.SyncStep(repo=repo, conduit=conduit, config=config,
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume that it is deliberate that neither v1/v2 can be turned off/on?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Austin wrote:

I assume that it is deliberate that neither v1/v2 can be turned off/on?

Indeed.

Randy Barlow
irc: bowlofeggs

@twaugh
Copy link

twaugh commented Jan 25, 2016

I tried this with the upstream feed set to http://my-pulp-server:8888 and although the v2 sync worked, the v1 sync failed because it was trying to use port 5000 instead of port 8888.

To be more specific: the /v1/repositories/.../images request gets its response (3 images), and the next thing to happen is a failed connection attempt to the wrong port (5000).

@twaugh
Copy link

twaugh commented Jan 25, 2016

After more investigation, it seems the incorrect-port issue was a configuration issue in my testing environment! Sorry.

But now that's fixed, I'm seeing another issue. This traceback was from a sync operation from a v1+v2 Crane instance:
https://gist.github.com/twaugh/f29af2b5b387bf90c989

@bowlofeggs
Copy link
Contributor Author

Hello @twaugh! I was unable to reproduce the issue you linked. I spent today making two new environments so that I could use one to sync from the other. I put Crane in the "primary", and created a test repository that had v1 and v2 content in it. When I synchronized this repository with a "secondary" Pulp server running on another host, everything worked smoothly.

For my test, I used a 2.8 Pulp as the "primary" because it is much easier for me to deploy. I actually did find a bug that affected 2.8 only in this process ( #120 ) but I don't believe that would have caused the traceback you saw.

Are you able to consistently reproduce this issue?

@twaugh
Copy link

twaugh commented Jan 26, 2016

I am. (More information sent privately.)

@bowlofeggs
Copy link
Contributor Author

For others' benefit, @twaugh privately sent me a host URL to try this with that reproduces the issue he is experiencing. I can confirm that I am unable to sync with that URL, but I believe the URL itself was the problem not the sync code, as I am unable to retrieve some of the needed files. It looks like a publish may have aborted in the middle, leaving a half-published repository in place.

I believe the code in this pull request does work, as I am able to sync from a Pulp 2.8 repository that has v1 and v2 published together, and the resulting publish on the "downstream" 2.6 repository appears to be sane.

@twaugh can you look more closely at the published output on the system that hosts the feed URL in question? Here is some output from my Pulp 2.8 "parent" system to give you an idea of what I would expect to see:

(pulp_docker)[fedora@rbarlow-test-v1v2-primary pulp_docker]$ sudo tree /var/lib/pulp/published/docker/                
/var/lib/pulp/published/docker/
├── v1
│   ├── app -> /home/fedora/devel/crane/metadata/v1
│   ├── master
│   │   ├── busybox
│   │   │   └── 1453752573.1
│   │   │       └── busybox.json
│   │   ├── registry
│   │   │   └── 1453749820.89
│   │   │       └── registry.json
│   │   └── test
│   │       └── 1453838032.39
│   │           ├── test.json
│   │           └── web
│   │               ├── 0f864637f229eee9da53fd5591fb58138b6bfb0196f0ee4fd9417d3655fb3d28
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/9192/9192c57d-d833-411a-b033-db6b22390fd8/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/9192/9192c57d-d833-411a-b033-db6b22390fd8/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/9192/9192c57d-d833-411a-b033-db6b22390fd8/layer
│   │               ├── 1c677c871a78a34d8af0f934762c121cb67c5ca9eb7f7aa82e031ad4f46d7b49
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/d9cd/d9cd7a2e-a78a-4f80-adfb-e228c1626185/ancestry
│   │               ├── 1c677c871a78a34d8af0f934762c121cb67c5ca9eb7f7aa82e031ad4f46d7b49                                                                                                                                            [64/1445]
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/d9cd/d9cd7a2e-a78a-4f80-adfb-e228c1626185/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/d9cd/d9cd7a2e-a78a-4f80-adfb-e228c1626185/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/d9cd/d9cd7a2e-a78a-4f80-adfb-e228c1626185/layer
│   │               ├── 2b8777f8541c6d03f7995f22506ecf4e4b3aaf73dc30a227844ab7c4cca16927
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/4e95/4e95f0cf-fee3-4909-a123-20a9998d6136/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/4e95/4e95f0cf-fee3-4909-a123-20a9998d6136/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/4e95/4e95f0cf-fee3-4909-a123-20a9998d6136/layer
│   │               ├── 2f90b06aea7cf527ab79513ca5a1eab7986c3d4c5c0c552a13d53279504d896b
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/817f/817f8376-f1cf-4dc8-8779-26faaab5f24d/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/817f/817f8376-f1cf-4dc8-8779-26faaab5f24d/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/817f/817f8376-f1cf-4dc8-8779-26faaab5f24d/layer
│   │               ├── 3b4e23f53d23c24ddc6e8368c22e54e2502c1061c192c7d33e06327a18a8e06f
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/9455/945587b4-1bf1-422d-8c52-104cadec4dc3/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/9455/945587b4-1bf1-422d-8c52-104cadec4dc3/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/9455/945587b4-1bf1-422d-8c52-104cadec4dc3/layer
│   │               ├── 3d5bcd78e074f6f77b820bf4c6db0e05d522e24c855f3c2a3bbf3b1c8f967ba8
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/dce1/dce1687b-678e-42fa-8ac9-ea7bab34ff87/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/dce1/dce1687b-678e-42fa-8ac9-ea7bab34ff87/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/dce1/dce1687b-678e-42fa-8ac9-ea7bab34ff87/layer
│   │               ├── 490a01806a96b46259b123d67d1c8607c7a749e28459492c99f2a8507f111818
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/6ce6/6ce60bee-0e27-47ce-bfa8-0c01e90699d9/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/6ce6/6ce60bee-0e27-47ce-bfa8-0c01e90699d9/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/6ce6/6ce60bee-0e27-47ce-bfa8-0c01e90699d9/layer
│   │               ├── 633fcd11259e8d6bccfbb59a4086b95b0d0fb44edfc3912000ef1f70e8a7bfc6
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/351d/351d0385-96f8-4163-963d-d885f95dc9f2/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/351d/351d0385-96f8-4163-963d-d885f95dc9f2/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/351d/351d0385-96f8-4163-963d-d885f95dc9f2/layer
│   │               ├── 77608b59d92f23a988df653ad660e91e04c72d20bfaf1a7f06ae6a6a79331482
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/ba73/ba73b1ef-b3ae-4f78-aa89-bc0abe020375/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/ba73/ba73b1ef-b3ae-4f78-aa89-bc0abe020375/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/ba73/ba73b1ef-b3ae-4f78-aa89-bc0abe020375/layer
│   │               ├── 79722f6accc3345ac95c95dd5dd4af5563cd68a04691e728df4724fc8e8ad581
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/5c27/5c2758aa-1887-4346-8671-0bb658f1ce8c/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/5c27/5c2758aa-1887-4346-8671-0bb658f1ce8c/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/5c27/5c2758aa-1887-4346-8671-0bb658f1ce8c/layer
│   │               ├── 79e69b372961d11d555c12fe0e2f0e8893abffb38ef43ef3eb479a3b654ae265
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/fb5d/fb5d31ec-9f25-43a7-b403-2c182d140f31/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/fb5d/fb5d31ec-9f25-43a7-b403-2c182d140f31/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/fb5d/fb5d31ec-9f25-43a7-b403-2c182d140f31/layer
│   │               ├── 964092b7f3e54185d3f425880be0b022bfc9a706701390e0ceab527c84dea3e3
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/93ca/93cacfb5-2d67-48c0-8844-1c9eab1da18e/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/93ca/93cacfb5-2d67-48c0-8844-1c9eab1da18e/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/93ca/93cacfb5-2d67-48c0-8844-1c9eab1da18e/layer
│   │               ├── 9e77fef7a1c9f989988c06620dabc4020c607885b959a2cbd7c2283c91da3e33
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/6e9d/6e9d27eb-3497-43b6-b5cf-0224a93ab5f4/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/6e9d/6e9d27eb-3497-43b6-b5cf-0224a93ab5f4/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/6e9d/6e9d27eb-3497-43b6-b5cf-0224a93ab5f4/layer
│   │               ├── a6dbc8d6ddbb9e905518a9df65f414efce038de5f253a081b1205c6cea4bac17
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/e119/e119a528-4c69-442e-a684-6c0244e6be6c/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/e119/e119a528-4c69-442e-a684-6c0244e6be6c/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/e119/e119a528-4c69-442e-a684-6c0244e6be6c/layer
│   │               ├── b65c936b5fb601d680ed656b1ccf8ab857c0e5cb521043a005405c194e9a69f3
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/b176/b17650f9-6c82-487b-bb70-555d84a662a1/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/b176/b17650f9-6c82-487b-bb70-555d84a662a1/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/b176/b17650f9-6c82-487b-bb70-555d84a662a1/layer
│   │               ├── bf0f46991aed1fa45508683e740601df23a2395c47f793883e4b0160ab906c1e
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/95d6/95d6ffa6-7601-48c4-89b8-5d35a7e0fa35/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/95d6/95d6ffa6-7601-48c4-89b8-5d35a7e0fa35/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/95d6/95d6ffa6-7601-48c4-89b8-5d35a7e0fa35/layer
│   │               ├── cf2616975b4a3cba083ca99bc3f0bf25f5f528c3c52be1596b30f60b0b1c37ff
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/b5d7/b5d7de97-c03e-497b-9eb9-5c67ea6d7e64/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/b5d7/b5d7de97-c03e-497b-9eb9-5c67ea6d7e64/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/b5d7/b5d7de97-c03e-497b-9eb9-5c67ea6d7e64/layer
│   │               ├── cfa753dfea5e68a24366dfba16e6edf573daa447abf65bc11619c1a98a3aff54
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/81ce/81ce4f4d-8780-432b-9c3e-277db09cf618/ancestry
│   │               ├── cfa753dfea5e68a24366dfba16e6edf573daa447abf65bc11619c1a98a3aff54                                                                                                                                             [0/1445]
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/81ce/81ce4f4d-8780-432b-9c3e-277db09cf618/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/81ce/81ce4f4d-8780-432b-9c3e-277db09cf618/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/81ce/81ce4f4d-8780-432b-9c3e-277db09cf618/layer
│   │               ├── d63a8412e9a1e5befa41747a6c0a36c069fe46b8f767d2a8b83070eb5c22d6c3
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/d382/d382baaf-2da2-437d-9def-d7116c994c7d/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/d382/d382baaf-2da2-437d-9def-d7116c994c7d/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/d382/d382baaf-2da2-437d-9def-d7116c994c7d/layer
│   │               ├── d7057cb020844f245031d27b76cb18af05db1cc3a96a29fa7777af75f5ac91a3
│   │               │   ├── ancestry -> /var/lib/pulp/content/units/docker_image/51a7/51a794c6-3350-4032-97fc-5194ee7bb022/ancestry
│   │               │   ├── json -> /var/lib/pulp/content/units/docker_image/51a7/51a794c6-3350-4032-97fc-5194ee7bb022/json
│   │               │   └── layer -> /var/lib/pulp/content/units/docker_image/51a7/51a794c6-3350-4032-97fc-5194ee7bb022/layer
│   │               └── ff8f955d1fed83a6239675b9a767fc9502db9934922a2f69ac6bf4cad8a7d7be
│   │                   ├── ancestry -> /var/lib/pulp/content/units/docker_image/c4f2/c4f2b832-1d1a-4673-98b8-3810496258bf/ancestry
│   │                   ├── json -> /var/lib/pulp/content/units/docker_image/c4f2/c4f2b832-1d1a-4673-98b8-3810496258bf/json
│   │                   └── layer -> /var/lib/pulp/content/units/docker_image/c4f2/c4f2b832-1d1a-4673-98b8-3810496258bf/layer
│   └── web
│       ├── busybox -> /var/lib/pulp/published/docker/v1/master/busybox/1453752573.1/web
│       ├── registry -> /var/lib/pulp/published/docker/v1/master/registry/1453749820.89/web
│       └── test -> /var/lib/pulp/published/docker/v1/master/test/1453838032.39/web
└── v2
    ├── app -> /home/fedora/devel/crane/metadata/v2
    ├── master
    │   ├── busybox
    │   │   └── 1453752573.1
    │   │       ├── busybox.json
    │   │       └── tags
    │   │           └── list
    │   ├── registry
    │   │   └── 1453749820.89
    │   │       ├── manifests
    │   │       │   └── 2 -> /var/lib/pulp/content/units/docker_manifest/2c43/2c43b73d-1001-4a58-8fce-159b5c48b907/sha256:ab7f901c05a8aa89766e755fc9fdb637ff30e8bfcdcb8c7bab0fccc95cebc33f
    │   │       ├── registry.json
    │   │       └── tags
    │   │           └── list
    │   └── test
    │       └── 1453838032.39
    │           ├── blobs
    │           │   ├── sha256:3b52deaaf0edb8a0282a08dd9c9e25da2050a75739b832ecc6e29941394933a6 -> /var/lib/pulp/content/units/docker_blob/de06/de06abb2-2659-473f-bbaf-c5c6ef66c492/sha256:3b52deaaf0edb8a0282a08dd9c9e25da2050a75739b832ecc
6e29941394933a6
    │           │   ├── sha256:4bd501fad6defc3af5638b82f7d760f0dc2f2c5f1bcd2cbfd59607b1631bc679 -> /var/lib/pulp/content/units/docker_blob/9a60/9a60181d-79c1-48a4-b977-3865866f61fd/sha256:4bd501fad6defc3af5638b82f7d760f0dc2f2c5f1bcd2cbfd
59607b1631bc679
    │           │   ├── sha256:5426c0c1c29311d735da21fb4eeea8f5895e5245e443de7e78577f6941f14499 -> /var/lib/pulp/content/units/docker_blob/852e/852ed3b1-4802-4b90-bc4b-fd26dd9d6a41/sha256:5426c0c1c29311d735da21fb4eeea8f5895e5245e443de7e7
8577f6941f14499
    │           │   ├── sha256:82c34c0ec0176dc210b10276375f5f7ead8fa5fdf569796839f71eb1ee15ff32 -> /var/lib/pulp/content/units/docker_blob/9d0d/9d0d2c2a-905f-4384-bf11-993c1f81a4d1/sha256:82c34c0ec0176dc210b10276375f5f7ead8fa5fdf56979683
9f71eb1ee15ff32
    │           │   ├── sha256:8387d9ff0016d004777e511a55e21672e4b6de49e32db2544b8ac0e2ee01d5ed -> /var/lib/pulp/content/units/docker_blob/0c29/0c291983-9903-4aef-9650-be685929807c/sha256:8387d9ff0016d004777e511a55e21672e4b6de49e32db2544
b8ac0e2ee01d5ed
    │           │   ├── sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00e8a7c22955b46d4 -> /var/lib/pulp/content/units/docker_blob/3cd1/3cd11fbb-cf7f-4d72-8ad4-aca84e4d51d3/sha256:a3ed95caeb02ffe68cdd9fd84406680ae93d633cb16422d00
e8a7c22955b46d4
    │           │   └── sha256:b1f99b5938be607aa8d45b3b4b7112023c9aba30154cf495d5e1c3adae02b08b -> /var/lib/pulp/content/units/docker_blob/2bc1/2bc15d7f-43ec-4c3a-a326-c403be9d4103/sha256:b1f99b5938be607aa8d45b3b4b7112023c9aba30154cf495d
5e1c3adae02b08b
    │           ├── manifests
    │           │   ├── 2 -> /var/lib/pulp/content/units/docker_manifest/2c43/2c43b73d-1001-4a58-8fce-159b5c48b907/sha256:ab7f901c05a8aa89766e755fc9fdb637ff30e8bfcdcb8c7bab0fccc95cebc33f
    │           │   └── sha256:ab7f901c05a8aa89766e755fc9fdb637ff30e8bfcdcb8c7bab0fccc95cebc33f -> /var/lib/pulp/content/units/docker_manifest/2c43/2c43b73d-1001-4a58-8fce-159b5c48b907/sha256:ab7f901c05a8aa89766e755fc9fdb637ff30e8bfcdcb8
c7bab0fccc95cebc33f
    │           ├── tags
    │           │   └── list
    │           └── test.json
    └── web
        ├── busybox -> /var/lib/pulp/published/docker/v2/master/busybox/1453752573.1
        ├── registry -> /var/lib/pulp/published/docker/v2/master/registry/1453749820.89
        └── test -> /var/lib/pulp/published/docker/v2/master/test/1453838032.39

52 directories, 84 files

Obviously, you are testing with different Images and Manifests than I am so you will have different units, but that should give you a sense of the expected structure for both v1 and v2.

@twaugh
Copy link

twaugh commented Jan 27, 2016

Thanks, problem identified now.

I've re-run my testing and I'm happy with this pull request. Thanks for helping diagnose the problems I was seeing!

self.sync_step = v1_sync.SyncStep(repo=repo, conduit=sync_conduit, config=config,
working_dir=working_dir)

self.sync_step = sync.SyncStep(repo=repo, conduit=sync_conduit, config=config,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to determine which docker api version here? For the use case of syncing both, if we could do it here, we could then avoid having v1 and v2 sync as child steps of the same step.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@asmacdo Unfortunately, this would prevent us from having one progress report per sync operation, which would not be compatible with Pulp's API.

@asmacdo asmacdo added the LGTM label Jan 30, 2016
@asmacdo asmacdo assigned bowlofeggs and unassigned asmacdo Jan 30, 2016
@bowlofeggs bowlofeggs merged commit 24b1abe into pulp:docker_v2_api Feb 1, 2016
@bowlofeggs bowlofeggs deleted the backport-1449 branch February 1, 2016 18:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants