Skip to content

Allow users to specify distribution and component when modifying content - #1492

Merged
quba42 merged 1 commit into
pulp:mainfrom
daviddavis:repository-modify-structure
Sep 2, 2026
Merged

Allow users to specify distribution and component when modifying content#1492
quba42 merged 1 commit into
pulp:mainfrom
daviddavis:repository-modify-structure

Conversation

@daviddavis

@daviddavis daviddavis commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Allow repositories/deb/apt/{pulp_id}/modify/ requests to add/remove packages using optional distribution and component parameters. The task will create or remove matching release structure content while preserving package-only behavior when both parameters are omitted.

fixes #1491

@daviddavis daviddavis changed the title Add repository modify structure metadata Allow users to specify distribution and component when modifying content Jul 29, 2026
@daviddavis
daviddavis marked this pull request as draft July 29, 2026 15:37
@daviddavis
daviddavis force-pushed the repository-modify-structure branch 4 times, most recently from 77c51ac to 80bb31b Compare July 29, 2026 18:49
@daviddavis
daviddavis marked this pull request as ready for review July 29, 2026 18:58
@daviddavis
daviddavis force-pushed the repository-modify-structure branch 4 times, most recently from 72f3350 to 251cab2 Compare July 30, 2026 12:13
@daviddavis
daviddavis marked this pull request as draft July 30, 2026 12:13
@daviddavis
daviddavis force-pushed the repository-modify-structure branch from 251cab2 to 9f78c10 Compare July 30, 2026 18:10
@daviddavis
daviddavis marked this pull request as ready for review July 30, 2026 19:36
@daviddavis
daviddavis force-pushed the repository-modify-structure branch from 9f78c10 to ca95206 Compare July 30, 2026 19:40
@quba42 quba42 added the .feature CHANGES/<issue_number>.feature label Aug 24, 2026
@quba42

quba42 commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

First of all: I really appreciate this change! I started by testing some workflows using this, against my own assumptions and expectations. Overall the current state makes very reasonable design choices. It appears to work well (though I have not yet tested the content removal workflows 😉)

That being said, on the details, there are several design choices I would like to have some (open ended) discussion on. To avoid this turning to chaotic, I am going to avoid GitHub's review feature for now, and will instead open a thread for each independent thing I would like to discuss. I may need a bit of time to add each thread below.

Comment thread CHANGES/1491.feature
Comment thread pulp_deb/app/tasks/signing.py Outdated
Comment thread pulp_deb/app/tasks/signing.py Outdated
Comment thread pulp_deb/app/serializers/repository_serializers.py Outdated
@quba42

quba42 commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

I am going to leave it at that for now. Note that while I may have produced a lot of text, all of the above are posed as open questions. Disagreeing with any implied changes is perfectly fine. If, after some discussion, we conclude we want to stay with the current design that is a perfectly reasonable outcome.

@daviddavis
daviddavis force-pushed the repository-modify-structure branch 2 times, most recently from 07bd0b6 to f318641 Compare August 28, 2026 12:44
@daviddavis

Copy link
Copy Markdown
Contributor Author

@quba42 I think I've addressed everything. Please let me know what you think.

@balasankarc

Copy link
Copy Markdown

cc @stanhu FYI as you worked on pulp/pulp-cli-deb#260

@daviddavis

daviddavis commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

@balasankarc @stanhu reading pulp/pulp-cli-deb#245, it seems like maybe the field here should be distributions instead of distribution? So that way you can add a package to multiple distributions when you add it to the repo. I don't think that would be too difficult to do.

@quba42 quba42 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found two more minor changes I would like to see.

With those final changes I am happy to merge. I have manually tested many workflows I wanted to see (like adding a package already in the repo to another ReleaseComponent, removing packages from just one ReleaseComponent. Removing a package from the repo and all ReleaseComponents (by not providing the new params). Adding multiple packages. Re-running a command that results in a noop because everything is already present, etc.

I also looked over the new automatic tests which provide good coverage for those same workflows I most wanted to test manually. 👍

Comment thread pulp_deb/app/serializers/repository_serializers.py Outdated
Comment thread pulp_deb/app/tasks/signing.py Outdated
Comment thread pulp_deb/app/tasks/signing.py
@quba42

quba42 commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

One thing I did not test is what happens when you provide both add_content_units and remove_content units and a component or distribution in a single call. From the way the individual calls work and how the code is structured I am pretty confident it will simply be the conjunction of the two individual calls. I am not sure how important this corner case is. I would expect the vast majority of users to split that request up into two calls, just because the request "add these packages to this ReleaseComponent and also remove these other packages from the same ReleaseComponent at the same time" is conceptually pretty weird. 😄

If you end up requesting the same package be added and also removed in the same call, I don't particularly care what happens since such a clearly contradictory request arguably should result in undefined behavior.

@daviddavis

Copy link
Copy Markdown
Contributor Author

I agree that most users will probably add/remove in a single call. It should handle requests to both add and remove content in a single call though by both adding and removing the packages that the user requests to add and remove.

The one edge case you alluded to where there is an overlap of content is not obvious for users though without looking at the code (I believe that the answer is that the content gets added). I agree though that we shouldn't worry about it since it's obviously unusual and contradictory.

@daviddavis
daviddavis force-pushed the repository-modify-structure branch 2 times, most recently from 38f6b71 to a943aaf Compare September 1, 2026 18:43
Allow repositories/deb/apt/{pulp_id}/modify/ requests to add/remove
packages using optional distribution and component parameters. The task
will create or remove matching release structure content while
preserving package-only behavior when both parameters are omitted.

fixes pulp#1491

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c96b6a1b-7b9e-4fea-ada4-73292625182f
@daviddavis
daviddavis force-pushed the repository-modify-structure branch from a943aaf to 75486ca Compare September 1, 2026 18:56
@daviddavis

Copy link
Copy Markdown
Contributor Author

I went ahead and added a new functional test (test_add_and_remove_packages_in_same_request) to test adding/removing packages a single request.

@quba42
quba42 merged commit b4be00d into pulp:main Sep 2, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

.feature CHANGES/<issue_number>.feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow users to supply distribution and component when modifying repo contents

3 participants