Project

Profile

Help

Story #5028

RepositoryVersion.create() can't be called outside of a task

Added by dkliban@redhat.com 6 months ago. Updated about 2 months ago.

Status:
MODIFIED
Priority:
Normal
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Platform Release:
Blocks Release:
Backwards Incompatible:
No
Groomed:
Yes
Sprint Candidate:
No
Tags:
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
Sprint:
Sprint 60

Description

Docker push requires creating a repository version without dispatching a task. This is currently impossible because the RepositoryVersion.create() method always creates a CreatedResource0. 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

Revision 111bf4cd View on GitHub
Added by Fabricio Aguiar about 2 months ago

Repository version creation w/o CreatedResource

Allowing to create a repository version without dispatching a task.
closes #5028
https://pulp.plan.io/issues/5028

History

#1 Updated by dkliban@redhat.com 5 months ago

  • Tracker changed from Issue to Story
  • % Done set to 0

#2 Updated by dkliban@redhat.com 5 months 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 4 months 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 4 months 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 2 months ago

  • Sprint/Milestone set to 3.0

#6 Updated by bmbouter about 2 months ago

  • Description updated (diff)

#7 Updated by bmbouter about 2 months ago

  • Description updated (diff)

#8 Updated by daviddavis about 2 months ago

  • Groomed changed from No to Yes
  • Sprint set to Sprint 60

#9 Updated by fabricio.aguiar about 2 months ago

  • Status changed from NEW to POST
  • Assignee set to fabricio.aguiar

#10 Updated by Anonymous about 2 months ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100

Please register to edit this issue

Also available in: Atom PDF