Project

Profile

Help

Issue #5252

closed

second sync creates orphaned tags with null tagged_manifests

Added by amacdona@redhat.com over 5 years ago. Updated almost 5 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Platform Release:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

Syncing from a repository more than once creates corrupt tags.

After syncing exactly 1 time, the tags appears correct.

(pulp) [vagrant@pulp3-source-fedora29 pulp_docker]$ http http://localhost:24817/pulp/api/v3/content/docker/tags/?name=manifest_a
HTTP/1.1 200 OK
Allow: GET, POST, HEAD, OPTIONS
Connection: close
Content-Length: 387
Content-Type: application/json
Date: Mon, 12 Aug 2019 18:43:44 GMT
Server: gunicorn/19.9.0
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "_artifact": "/pulp/api/v3/artifacts/435553c9-1ec7-4c61-b4cd-5a04d281f2e1/",
            "_created": "2019-08-12T18:43:37.635061Z",
            "_href": "/pulp/api/v3/content/docker/tags/0579ffee-8014-4e74-9ccd-b2f77a37a6a6/",
            "_type": "docker.tag",
            "name": "manifest_a",
            "tagged_manifest": "/pulp/api/v3/content/docker/manifests/e53bba07-5759-4515-b033-e12f9c6da82b/"
        }
    ]
}

The second sync erroneously creates a new tag of the same name with `tagged_manifest=null`

(pulp) [vagrant@pulp3-source-fedora29 pulp_docker]$ http http://localhost:24817/pulp/api/v3/content/docker/tags/?name=manifest_a
HTTP/1.1 200 OK
Allow: GET, POST, HEAD, OPTIONS
Connection: close
Content-Length: 650
Content-Type: application/json
Date: Mon, 12 Aug 2019 18:45:24 GMT
Server: gunicorn/19.9.0
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN

{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        {
            "_artifact": "/pulp/api/v3/artifacts/435553c9-1ec7-4c61-b4cd-5a04d281f2e1/",
            "_created": "2019-08-12T18:45:19.139870Z",
            "_href": "/pulp/api/v3/content/docker/tags/6e6f41fd-a40c-4c21-816b-deb52fc8ddaa/",
            "_type": "docker.tag",
            "name": "manifest_a",
            "tagged_manifest": null
        },
        {
            "_artifact": "/pulp/api/v3/artifacts/435553c9-1ec7-4c61-b4cd-5a04d281f2e1/",
            "_created": "2019-08-12T18:43:37.635061Z",
            "_href": "/pulp/api/v3/content/docker/tags/0579ffee-8014-4e74-9ccd-b2f77a37a6a6/",
            "_type": "docker.tag",
            "name": "manifest_a",
            "tagged_manifest": "/pulp/api/v3/content/docker/manifests/e53bba07-5759-4515-b033-e12f9c6da82b/"
        }
    ]
}

Fortunately, the repositories seem to be unaffected. Both repository versions only contain the original tag, which has tagged_manifest correctly set. The extra tag is an orphan.

(pulp) [vagrant@pulp3-source-fedora29 pulp_docker]$ http "http://localhost:24817/pulp/api/v3/content/docker/tags/?repository_version=/pulp/api/v3/repositories/0786cb63-7f87-4c14-8782-7e74bae341ee/versions/1/&name=manifest_a"
HTTP/1.1 200 OK
Allow: GET, POST, HEAD, OPTIONS
Connection: close
Content-Length: 387
Content-Type: application/json
Date: Mon, 12 Aug 2019 18:54:00 GMT
Server: gunicorn/19.9.0
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "_artifact": "/pulp/api/v3/artifacts/435553c9-1ec7-4c61-b4cd-5a04d281f2e1/",
            "_created": "2019-08-12T18:43:37.635061Z",
            "_href": "/pulp/api/v3/content/docker/tags/0579ffee-8014-4e74-9ccd-b2f77a37a6a6/",
            "_type": "docker.tag",
            "name": "manifest_a",
            "tagged_manifest": "/pulp/api/v3/content/docker/manifests/e53bba07-5759-4515-b033-e12f9c6da82b/"
        }
    ]
}

(pulp) [vagrant@pulp3-source-fedora29 pulp_docker]$ http "http://localhost:24817/pulp/api/v3/content/docker/tags/?repository_version=/pulp/api/v3/repositories/0786cb63-7f87-4c14-8782-7e74bae341ee/versions/2/&name=manifest_a"
HTTP/1.1 200 OK
Allow: GET, POST, HEAD, OPTIONS
Connection: close
Content-Length: 387
Content-Type: application/json
Date: Mon, 12 Aug 2019 18:54:08 GMT
Server: gunicorn/19.9.0
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN

{
    "count": 1,
    "next": null,
    "previous": null,
    "results": [
        {
            "_artifact": "/pulp/api/v3/artifacts/435553c9-1ec7-4c61-b4cd-5a04d281f2e1/",
            "_created": "2019-08-12T18:43:37.635061Z",
            "_href": "/pulp/api/v3/content/docker/tags/0579ffee-8014-4e74-9ccd-b2f77a37a6a6/",
            "_type": "docker.tag",
            "name": "manifest_a",
            "tagged_manifest": "/pulp/api/v3/content/docker/manifests/e53bba07-5759-4515-b033-e12f9c6da82b/"
        }
    ]
}

Heres a functional test to reproduce the error:


import unittest

from pulp_smash import api, config
from pulp_smash.pulp3.constants import REPO_PATH
from pulp_smash.pulp3.utils import gen_repo, sync

from pulp_docker.tests.functional.constants import (
    DOCKER_TAG_PATH,
    DOCKER_REMOTE_PATH,
    DOCKERHUB_PULP_FIXTURE_1,
)
from pulp_docker.tests.functional.utils import gen_docker_remote

class TestSanity(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        cls.cfg = config.get_config()
        cls.client = api.Client(cls.cfg, api.json_handler)
        cls.from_repo = cls.client.post(REPO_PATH, gen_repo())
        remote_data = gen_docker_remote(upstream_name=DOCKERHUB_PULP_FIXTURE_1)
        cls.remote = cls.client.post(DOCKER_REMOTE_PATH, remote_data)

    @classmethod
    def tearDownClass(cls):
        """Delete things made in setUpClass. addCleanup feature does not work with setupClass."""
        cls.client.delete(cls.from_repo['_href'])
        cls.client.delete(cls.remote['_href'])

    def test_sync_idempotentcy(self):
        sync(self.cfg, self.remote, self.from_repo)
        first_sync_tags_named_a = self.client.get("{unit_path}?{filters}".format(
            unit_path=DOCKER_TAG_PATH,
            filters="name=manifest_a",
        ))
        sync(self.cfg, self.remote, self.from_repo)
        second_sync_tags_named_a = self.client.get("{unit_path}?{filters}".format(
            unit_path=DOCKER_TAG_PATH,
            filters="name=manifest_a",
        ))
        self.assertEqual(first_sync_tags_named_a['count'], second_sync_tags_named_a['count'])

RESULT:

>       self.assertEqual(first_sync_tags_named_a['count'], second_sync_tags_named_a['count'])
E       AssertionError: 1 != 2

pulp_docker/tests/functional/api/test_sanity.py:44: AssertionError
Actions #1

Updated by amacdona@redhat.com over 5 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to amacdona@redhat.com

I'm taking this because it is blocking the merge of https://github.com/pulp/pulp_docker/pull/394

Because that PR and the new tagging work both sync the fixture, we get null tagged_manifests, which breaks the tagging tests.

Added by amacdona@redhat.com over 5 years ago

Revision c977bf19 | View on GitHub

Fix bug, repeated sync creates orphan invalid tags

https://pulp.plan.io/issues/5252 fixes #5252

Added by amacdona@redhat.com over 5 years ago

Revision c977bf19 | View on GitHub

Fix bug, repeated sync creates orphan invalid tags

https://pulp.plan.io/issues/5252 fixes #5252

Added by amacdona@redhat.com over 5 years ago

Revision c977bf19 | View on GitHub

Fix bug, repeated sync creates orphan invalid tags

https://pulp.plan.io/issues/5252 fixes #5252

Added by amacdona@redhat.com over 5 years ago

Revision c977bf19 | View on GitHub

Fix bug, repeated sync creates orphan invalid tags

https://pulp.plan.io/issues/5252 fixes #5252

Actions #2

Updated by amacdona@redhat.com over 5 years ago

  • Status changed from ASSIGNED to MODIFIED

Applied in changeset commit:pulp_docker|c977bf19597949f04d043a12cdf457e15a582b04.

Actions #4

Updated by ipanova@redhat.com about 5 years ago

  • Project changed from Docker Support to Container Support
Actions #5

Updated by ipanova@redhat.com about 5 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Actions #6

Updated by ipanova@redhat.com almost 5 years ago

  • Sprint/Milestone set to 1.0.0

Also available in: Atom PDF