Fix deploy tokens usage for npm uploads with temporary package
Context
In Use temporary package for npm upload (!211279 - merged) we've implemented the changes to npm upload endpoint to use a temporary page. The changes were implemented behind the feature flag. During the feature flag rollout the issue with Deploy Tokens was revealed https://gitlab.com/gitlab-org/gitlab/-/issues/578214#note_2944686490. Basically, when a Deploy Token is used to upload a package, then we pass its id to the background worker. However, the background worker was always looking for a User with provided id.
What does this MR do and why?
Fix deploy tokens usage for npm uploads with temporary package
Replace user_id argument with GlobalID. Support Deploy Token and User models.
References
- https://gitlab.com/gitlab-org/gitlab/-/issues/578214+
- Use temporary package for npm upload (!211279 - merged)
Screenshots or screen recordings
No.
How to set up and validate locally
Enable feature flag
Feature.enable(:packages_npm_temp_package)
Try the following registry operations with PAT and Deploy Token.
Publish a new npm package
https://docs.gitlab.com/user/packages/npm_registry/#publish-to-gitlab-package-registry
Deprecate existing package version
https://docs.gitlab.com/user/packages/npm_registry/#deprecate-a-package
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #578214