Project

Profile

Help

Task #8740

closed

[EPIC] Publication based plugins should use either `distribution.repository` or `distribution.publication` but not both

Added by bmbouter over 1 year ago. Updated 9 months ago.

Status:
CLOSED - DUPLICATE
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
% Done:

100%

Estimated time:
(Total: 0:00 h)
Platform Release:
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

Ticket moved to GitHub: "pulp/pulpcore/1993":https://github.com/pulp/pulpcore/issues/1993


Problems

  1. Currently, when auto-publish creates a publication, for distributions to go live with that the code needs to make a data change on the distribution. Here is an example in pulp_rpm. This requires the sync+publish code to lock on every distribution referencing the repository being sync'd. So instead of a lock like ["repository foo"] you get ["repository foo", "some distribution" "another distribution", "maybe a third distribution"].

  2. Using both fields doesn't capture the user's intent. If a user wants to have a distribution always publish the latest publication setting the distribution.repository captures that nicely. If a user wants to have a distribution distribute a specific version of a publication (even if newer ones get created) setting distribution.publication captures that nicely. What we've got though is both fields being used together which captures conflicting requirements, they want the latest publication for a repository, but they also want this specific publication? If the distribution.publication is poiting to the latest publication then we're using two pieces of data when we only need one.

Why did we do it this way?

I suspect because it was convenient since the content app already knows how to serve distribution.publication so by setting that data the publication will serve correctly.

What to do instead?

  1. For plugins that use publications, have their Distribution serializers validate to not allow both repository and publication at the same time.
  2. Provide a migration to fix the data in cases where both are used.
  3. Update the content app to find the latest publication when MyDistribution.repository is set and MyDistribution.publication is unset. This would happen here. This is roughly how the content app auto distributes non-publication plugins, see the implementation here.

Subtasks 5 (0 open5 closed)

RPM Support - Story #8759: Adjust auto-publish feature to not modify distributionsCLOSED - CURRENTRELEASE

Actions
Story #8760: Setup Content App to auto-distribute latest publication if `SomeDistribution.repository` is setCLOSED - CURRENTRELEASEgerrod

Actions
Story #8761: Add validation to Distribution serializerCLOSED - CURRENTRELEASE

Actions
File Support - Story #8762: Adjust auto-publish feature to not modify distributionsCLOSED - CURRENTRELEASE

Actions
Task #8792: Test autodistribute in pulpcore fails after changing plugins to no longer modify distributionsCLOSED - CURRENTRELEASE

Actions

Related issues

Related to RPM Support - Story #8673: Auto-publishing should be more fault-tolerantCLOSED - DUPLICATE

Actions
Actions #1

Updated by bmbouter over 1 year ago

By not having to also update the distributions I think we'll be going a step closer to this request also: https://pulp.plan.io/issues/8673

Actions #2

Updated by dalley over 1 year ago

I would additionally suggest adding a database constraint (in core) so that plugin writers can't violate this invariant or mess up the validation.

Something equivalent to

~Q(repository_isnull=False, repository_version__isnull=False) & ~Q(repository_isnull=False, publication__isnull=False)

Actions #3

Updated by dalley over 1 year ago

  • Related to Story #8673: Auto-publishing should be more fault-tolerant added
Actions #4

Updated by bmbouter over 1 year ago

dalley, would you be able to list the plugins that need this change?

Actions #5

Updated by dalley over 1 year ago

It should be only file, rpm, and python.

But only file has been released with support AFAIK.

Actions #6

Updated by bmbouter over 1 year ago

  • Subject changed from Publication based plugins should use either `distribution.repository` or `distribution.publication` but not both to [EPIC] Publication based plugins should use either `distribution.repository` or `distribution.publication` but not both
Actions #7

Updated by pulpbot 9 months ago

  • Description updated (diff)
  • Status changed from NEW to CLOSED - DUPLICATE

Also available in: Atom PDF