Backport: Publish the Pulp repository if the uploaded RPM is not published (19-4)
What does this MR do and why?
Backport of !10085 (merged) to 19-4-stable, with git cherry-pick -x of 33e42118.
With PULP_CLI_PUBLISH=false, RPM uploads use --no-publish, and Pulp publishes the repository inside the upload task (autopublish). If the Pulp worker dies after the new repository version is saved, that version gets no publication. A retry makes no new version, so Pulp does not publish, the job passes, and the package is never served. This happened on 2026-11-11 for 4 gitlab-pre-release-* repositories during 19.4.7.
After each RPM upload with --no-publish, the upload code now:
- Finds the newest publication of the repository:
pulp rpm publication list --repository <repo> --ordering -pulp_created --limit 1 - Checks if its repository version contains the package, by the SHA256 of the file:
pulp rpm content -t package list --sha256 <sha256> --repository-version <repository_version> --limit 1 - Publishes the repository if the package is not there, if the repository has no publication, or if the check fails.
Deb uploads and the default path (PULP_CLI_PUBLISH not false) make no extra calls. The builder image of this branch has pulp-cli 0.35.1, which has all the options above. The cherry-pick applied without conflicts. spec/lib/gitlab/package_repository/ passes with PULP_CLI_PUBLISH unset and false, and RuboCop has no offenses.
PULP_CLI_PUBLISH on dev.gitlab.org is true now, as a short-term protection. After all backports merge, it goes back to false.
Related to gitlab-com/gl-infra/delivery#22556
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
- This MR is backporting a bug fix, documentation update, or spec fix, previously merged in the default branch.
- The original MR has been deployed to GitLab.com (not applicable for documentation or spec changes).
- This MR has a severity label assigned (if applicable).
Note to the merge request author and maintainer
If you have questions about the patch release process, please:
- Refer to the patch release runbook for engineers and maintainers for guidance.
- Ask questions on the
#releasesSlack channel (internal only).