Managing a mirror rpm repository

Hi all,

I wanted to start with a simple local mirror repository having only the latest packages in it, like reposync --newest-only does. Also I’d like to keep different versions of that repository, like for testing, staging and production use

To begin with, I set up a podman container:

mkdir -p settings pulp_storage pgsql/data containers
cat > settings/settings.py <<EOF
CONTENT_ORIGIN='http://$(hostname):8080'
ANSIBLE_API_HOSTNAME='http://$(hostname):8080'
ANSIBLE_CONTENT_HOSTNAME='http://$(hostname):8080/pulp/content'
TOKEN_AUTH_DISABLED=True
EOF

podman run --detach \
	--publish 8080:80 \
	--name pulp \
	--volume "${PWD}/settings":/etc/pulp:Z \
	--volume "${PWD}/pulp_storage":/var/lib/pulp:Z \
	--volume "${PWD}/pgsql":/var/lib/pgsql:Z \
	--volume "${PWD}/containers":/var/lib/containers:Z \
	--device /dev/fuse \
	pulp/pulp

That’s what I’ve done so far:

pulp rpm remote create \
    --name remote-testrepo \
    --url https://reposerver.example/8/x86_64/

pulp rpm repository create \
    --name testrepo \
    --remote remote-testrepo \
    --retain-package-versions 1 \ 
    --gpgcheck 1

pulp rpm repository show --name testrepo | \
  jq '{gpgcheck, retain_package_versions}'
# {
#   "gpgcheck": 1,
#   "retain_package_versions": 1
# }

pulp rpm repository sync --name testrepo

After the last step pulp has downloaded all versions of all packages, not only the latest rpms. How come? Do I confuse retain_package_versions with retain_repo_versions?

Next I create a distribution and publish the repository:

pulp rpm distribution create \
   --name mytest --base-path mytest \
   --repository testrepo

pulp rpm publication create --repository testrepo

As expected (but not wanted) I have published a repository with all versions of the corresponding packages.

But also the config.repo shows:

[mytest]
enabled=1
baseurl=http://localhost:8080/pulp/content/mytest/
gpgcheck=0
repo_gpgcheck=0

Why is gpgcheck set to 0 even though I’ve set it to 1 when creating the repository? And how do I add a gpg key?
All packages from the remote mirror are signed.

For the cleanup, how does it work?

pulp rpm publication destroy --href /pulp/api/v3/publications/rpm/rpm/$uuid/
pulp rpm distribution destroy --name mytest
pulp rpm repository destroy --name testrepo
pulp rpm remote destroy --name remote-testrepo

du -hs pulp_storage/
# 608M	pulp_storage/

pulp orphan cleanup | jq .progress_reports
# [
#   {
#     "message": "Clean up orphan Content",
#     "code": "clean-up.content",
#     "state": "completed",
#     "total": 0,
#     "done": 0,
#     "suffix": null
#   },
#   {
#     "message": "Clean up orphan Artifacts",
#     "code": "clean-up.content",
#     "state": "completed",
#     "total": 0,
#     "done": 0,
#     "suffix": null
#   }
# ]

du -hs pulp_storage/
# 608M	pulp_storage/

pulp content list
# Not all 635 entries were shown.
# …

for i in waiting skipped running failed canceled canceling; do pulp task list --state $i; done
# []
# 
# []
# 
# []
# 
# []
# 
# []
# 
# []
# 

There’s nothing deleted at all.

The pulp versions I use:

pulp status | jq .versions
# [
#   {
#     "component": "core",
#     "version": "3.15.2"
#   },
#   {
#     "component": "rpm",
#     "version": "3.15.0"
#   },
#   {
#     "component": "python",
#     "version": "3.5.0"
#   },
#   {
#     "component": "file",
#     "version": "1.9.1"
#   },
#   {
#     "component": "deb",
#     "version": "2.15.0"
#   },
#   {
#     "component": "container",
#     "version": "2.8.0"
#   },
#   {
#     "component": "certguard",
#     "version": "1.5.0"
#   },
#   {
#     "component": "ansible",
#     "version": "0.10.0"
#   }
# ]

Do you have any ideas on what I’m doing wrong?

nvm about the retain_package_versions thingy. Somehow it works now, the only thing I changed is that the container is now running on an Oracle Linux 8 host instead of Fedora 34.

Regarding the gpgcheck: if the repository is set up with --autopublish the gpgcheck flag gets carried into the publication. Nice. No idea why it doesn’t work with --no-autopublish and manual publishing, though.

I couldn’t figure out about how to add an uri to gpgkeys and about the cleanup issue, though :\

@wheezer, Would you mind filing an issue in our tracker? Issues - RPM Support - Pulp

The behavior you’ve described sounds like it could be a bug, or at least something we need to polish so that it’s less confusing.

2 Likes