Wrong docker tags copied over on publish
- Create a docker hub account. (https://cloud.docker.com/)
- Install docker on a machine
- 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
- On your katello ui create a docker repo with the following data -> name: repo1, feed: https://registry-1.docker.io , upstream: <username>/alpine
- Sync repo1. Make sure you see a repo with 2 tags
- Now go to https://cloud.docker.com/swarm/<username>/repository/docker/<username>/alpine/tags and delete the "latest" tag
- On your katello ui create a docker repo with the following data -> name: repo2, feed: https://registry-1.docker.io , upstream: <username>/alpine
- Sync repo2. Make sure you see a repo with 1 tag
- Finally create a content view
- Add repo2 via Docker Content to the cv. Make sure its the repo that has 1 tag
- Create a Docker Content View Filter With the following data -> Type: Include
- Under Tags add a rule to only include the "greatest" tag
- Finally publish the content view and check out the published version
A successful publish with 2 manifests and 1 Tag
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"
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
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