Project

General

Profile

Bug #21681

Wrong docker tags copied over on publish

Added by Partha Aji almost 4 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Container
Target version:
Difficulty:
Triaged:
Bugzilla link:
Fixed in Releases:
Found in Releases:

Description

  1. Create a docker hub account. (https://cloud.docker.com/)
  2. Install docker on a machine
  3. Run the following commands
    docker login -u <username> docker.io
    docker pull alpine
    docker tag docker.io/alpine:latest docker.io/<username>/alpine:latest
    docker tag docker.io/alpine:latest docker.io/<username>/alpine:greatest
    docker push docker.io/<username>/alpine
    
  4. On your katello ui create a docker repo with the following data -> name: repo1, feed: https://registry-1.docker.io , upstream: <username>/alpine
  5. Sync repo1. Make sure you see a repo with 2 tags
  6. Now go to https://cloud.docker.com/swarm/&lt;username&gt;/repository/docker/&lt;username&gt;/alpine/tags and delete the "latest" tag
  7. On your katello ui create a docker repo with the following data -> name: repo2, feed: https://registry-1.docker.io , upstream: <username>/alpine
  8. Sync repo2. Make sure you see a repo with 1 tag
  9. Finally create a content view
  10. Add repo2 via Docker Content to the cv. Make sure its the repo that has 1 tag
  11. Create a Docker Content View Filter With the following data -> Type: Include
  12. Under Tags add a rule to only include the "greatest" tag
  13. Finally publish the content view and check out the published version

Expected:
A successful publish with 2 manifests and 1 Tag

Actual:
A successful publish but the manifest shows 2 Tags instead

A further look at the publish task and expanding "13: Actions::Pulp::Repository::CopyDockerTag (success) [ 1.82s / 0.39s ]"

will show the following clause.

---
source_pulp_id: f93edc01-4915-45c8-a484-e926c561949f
target_pulp_id: 1-jonathan-v1_0-f93edc01-4915-45c8-a484-e926c561949f
clauses:
  "$or":
  - name:
      "$in":
      - latest
      - greatest
      - greatest
      - greatest
      - greatest
remote_user: admin
remote_cp_user: admin
locale: en

So even though the content filter should have only published "greatest" since the source repo had only the 'greatest' tag, we are ending up copying both "greatest" and "latest"

Associated revisions

Revision 9b45392b (diff)
Added by Partha Aji almost 4 years ago

Fixes #21681 - CV Docker Filters selects correctly

Consider Content View with a Docker repo and Docker Tag filter that
says filter by Tag "goo". And assume that the same Manifest exists in
two separate repositories Repo1 and Repo2 where
Repo1 =>Manifest1=>Tags [latest, goo] and
Repo2 =>Manifest1=> Tags[latest]
Now suppose the ContentView had Repo2 along with the Tag Filter to
include manifests with the name 'goo' and wanted to publish it. Our
filter should copy no Tags because there is nothing called 'goo' in
repo2.
Before this commit however this code would include goo in its clause
because of a faulty query.
This commit fixes that by improving the query to include tags in the
repository belonging to the manifest first.

This commit also fixes a "docker tag counts" issue in the content view
version so that tags with the same name for schema1 and 2 are
not double counted.

Finally it removes an unused method in the content view version also
related to docker_tags

History

#1 Updated by Partha Aji almost 4 years ago

  • Bugzilla link set to 1513769

#2 Updated by The Foreman Bot almost 4 years ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/Katello/katello/pull/7066 added

#3 Updated by Partha Aji almost 4 years ago

  • % Done changed from 0 to 100
  • Status changed from Ready For Testing to Closed

#4 Updated by Justin Sherrill almost 4 years ago

  • Legacy Backlogs Release (now unused) set to 284

Also available in: Atom PDF