Story #5028
RepositoryVersion.create() can't be called outside of a task
100%
Description
Docker push requires creating a repository version without dispatching a task. This is currently impossible because the RepositoryVersion.create() method always creates a CreatedResource[0]. A CreatedResource requires a task_id to be saved to the database.
Solution¶
Have the RepositoryVersion.create() check if it's running inside a task. You can do that with Task.current [1].
[0]: https://github.com/pulp/pulpcore/blob/06c7412525c0196169690125eecd63fad3548752/pulpcore/app/models/repository.py#L435
[1]: https://github.com/pulp/pulpcore/blob/8c3798cee5935c6c01af0cf83bdea2359926bfad/pulpcore/app/models/task.py#L339-L350
Associated revisions
History
#1
Updated by dkliban@redhat.com over 1 year ago
- Tracker changed from Issue to Story
- % Done set to 0
#2
Updated by dkliban@redhat.com over 1 year ago
This was filed as part of the docker push workflow work. A possible alternative solution to the problem has been discussed on IRC. This solution would allow plugin writers to create content sets that are not repository versions. Plugin writers would then be able to dispatch a task to either create a repository version from that whole set or to add that content to an existing repository version.
#3
Updated by dkliban@redhat.com over 1 year ago
We should implement this as written in the description. The Docker API is synchronous. It needs to be able to create repository versions synchronously.
#4
Updated by bmbouter over 1 year ago
I don't think the plugin writer benefits from another parameter to allow this to run outside of a task or not. The plugin writer is creating it, and we should allow them to have it wherever they want.
#5
Updated by dkliban@redhat.com over 1 year ago
- Sprint/Milestone set to 3.0.0
#6
Updated by bmbouter over 1 year ago
- Description updated (diff)
#7
Updated by bmbouter over 1 year ago
- Description updated (diff)
#8
Updated by daviddavis over 1 year ago
- Groomed changed from No to Yes
- Sprint set to Sprint 60
#9
Updated by fao89 over 1 year ago
- Status changed from NEW to POST
- Assignee set to fao89
#10
Updated by Anonymous over 1 year ago
- Status changed from POST to MODIFIED
- % Done changed from 0 to 100
Applied in changeset pulpcore|111bf4cd625b1b9ddfe1b586595261ae441ac865.
#11
Updated by bmbouter about 1 year ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Please register to edit this issue
Repository version creation w/o CreatedResource
Allowing to create a repository version without dispatching a task. closes #5028 https://pulp.plan.io/issues/5028