ok this way it works :
# Updating repository
export REPO_HREF=$(pulp rpm repository update --retain-package-versions ${RETAIN_PACKAGE} --name=${REPONAME} | jq -r ‘.pulp_href’)
Inspecting Repository
pulp rpm repository show --name “${REPONAME}”
update content of repository
LATEST_VERSION_NUM=$(pulp rpm repository version show --repository ${REPONAME} | jq -r .number)
pulp rpm repository content modify --repository ${REPONAME} --base-version ${LATEST_VERSION_NUM}
Sync repository
echo “Create a task to sync the repository using the remote.”
pulp rpm repository update --name “${REPONAME}” --remote “${REPONAME}”
pulp rpm repository sync --name “${REPONAME}” --remote “${REPONAME}”
Create RPM publication
echo “Create a task to create a publication.”
TASK_HREF=$(pulp rpm publication create --repository “${REPONAME}” 2>&1 >/dev/null | awk ‘{print $4}’)
Updating RPM distribution for publication
echo “Set PUBLICATION_HREF from finished task.”
PUBLICATION_HREF=$(pulp show --href “${TASK_HREF}” | jq -r ‘.created_resources | first’)
export PUBLICATION_HREF
echo “updating the rpm distribtion for publication”
pulp rpm distribution update --name “${REPONAME}” --publication “${PUBLICATION_HREF}”
packets are removed.
Now I did the reverse test by wanting to increase the --retain-package-versions parameter to 5, I run the same script but I notice that the task returns me “Skipping Sync (no change from previous sync)”
(venv-pulp3) [admin@pulp pulp3]$ pulp show --href /pulp/api/v3/tasks/1a6844ad-32d1-4f76-bc06-9a9c33699c09/
{
“pulp_href”: “/pulp/api/v3/tasks/1a6844ad-32d1-4f76-bc06-9a9c33699c09/”,
“pulp_created”: “2022-08-09T16:01:02.156484Z”,
“state”: “completed”,
“name”: “pulp_rpm.app.tasks.synchronizing.synchronize”,
“logging_cid”: “1df70162cb494eaf87544546521c5e19”,
“started_at”: “2022-08-09T16:01:02.199749Z”,
“finished_at”: “2022-08-09T16:01:02.728585Z”,
“error”: null,
“worker”: “/pulp/api/v3/workers/bcccb229-28e8-4f21-898f-e72e3aadddbd/”,
“parent_task”: null,
“child_tasks”: [],
“task_group”: null,
“progress_reports”: [
{
“message”: “Skipping Sync (no change from previous sync)”,
“code”: “sync.was_skipped”,
“state”: “completed”,
“total”: 1,
“done”: 1,
“suffix”: null
}
],
“created_resources”: [],
“reserved_resources_record”: [
“/pulp/api/v3/repositories/rpm/rpm/8eb364d7-9441-4877-b792-6f11eafb3c4d/”,
“shared:/pulp/api/v3/remotes/rpm/rpm/eed02370-3829-4c75-93b6-3781bf50bc39/”
]
}