-
-
Notifications
You must be signed in to change notification settings - Fork 374
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to add/switch components of a published local repository #1356
base: master
Are you sure you want to change the base?
Allow to add/switch components of a published local repository #1356
Conversation
0d96e4b
to
18ffde2
Compare
changing the logging is a bit tricky, since the aptly output is used extensively in the testing. but I like the cleanup ! if you wanna update the tests with the new logs automatically, uncomment CAPTURE in the Makefile locally and run the system-tests (it will write new gold files) ;-) |
18ffde2
to
bcab28d
Compare
Thanks a lot. I was not aware of the consequences. Unfortunately, we must change the output of the switch command and make it more generic, so that it can be also used for published local repositories. It requires some time for fixing the test cases. |
9c64533
to
eb6acfd
Compare
amazing work :) I sent you an invitation as maintainer, it would be great to have more of your contribution as well as reviewing some PRs (i.e. #1352) to move things forward a bit faster ! |
I dont have the rights to push to your branch, but here would be the golang-lint fix: eb15a65 :-) |
there is one more log update in a S3 test (where your i does not have creds): https://github.com/aptly-dev/aptly/actions/runs/11153050817/job/30999844378#step:9:1456 |
1924941
to
e97725c
Compare
@neolynx
|
e97725c
to
744c0d9
Compare
Ok, that is strange. The flag that the maintainer has editing rights is set. |
01a4452
to
1a9638b
Compare
This commit modifies the behavior of the publish switch method in the way, that it can also be used to add/switch components of a published local repository. Furthermore, the commit ensures that the sources returned by a published repository are ordered by their component names. Signed-off-by: Christoph Fiehe <c.fiehe@eurodata.de>
1a9638b
to
584146f
Compare
coverage 76.85% of diff hit (target 74.90%) nice ! |
It finally turns into green 😅. Thanks a lot for your support. |
func apiPublishUpdateSwitch(c *gin.Context) { | ||
param := parseEscapedPath(c.Params.ByName("prefix")) | ||
storage, prefix := deb.ParsePrefix(param) | ||
distribution := c.Params.ByName("distribution") | ||
distribution := parseEscapedPath(c.Params.ByName("distribution")) | ||
|
||
var b struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to document the body json parameters: See https://github.com/aptly-dev/aptly/blob/feature/176-snapshot-pull-api/api/snapshot.go#L506
@@ -363,14 +452,27 @@ func apiPublishUpdateSwitch(c *gin.Context) { | |||
}) | |||
} | |||
|
|||
// DELETE /publish/:prefix/:distribution | |||
// @Summary Delete published repository | |||
// @Description Delete a published repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make bold, no dot: **Delete a published repository**
copy api and field description from here: https://www.aptly.info/doc/api/publish/
} | ||
|
||
// @Summary Create published repository | ||
// @Description Create a published repository with specified parameters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
document json params
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make description bold, not dot
Another more high level question: if we add a /remove in the other PR, shouldn't we add a /add here instead of modifying the existing update/switch ? We could also keep the switch/update not touching the snapshots/components, but rather remember the multi-dist, and add 2 new APIs for adding/removing them, maybe call them /extend and /redude ? just thinking loudly, now that I see the full picture ... :) |
func apiPublishUpdateSwitch(c *gin.Context) { | ||
param := parseEscapedPath(c.Params.ByName("prefix")) | ||
storage, prefix := deb.ParsePrefix(param) | ||
distribution := c.Params.ByName("distribution") | ||
distribution := parseEscapedPath(c.Params.ByName("distribution")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great !
Yes, I had the same thoughts. It "feels" a little bit asymmetric, having a
I am not sure, if I get that right. Before the enhancements, the We can introduce two new commands in the CLI publish group, e.g. In the REST API, we can introduce |
// @Summary Get publish points | ||
// @Description Get list of available publish points. Each publish point is returned as in “show” API. | ||
// @Summary Get published repositories | ||
// @Description Get a list of published repositories. Each published repository is returned as in "show" API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make bold with **
, no dot
@@ -245,11 +289,22 @@ func apiPublishRepoOrSnapshot(c *gin.Context) { | |||
}) | |||
} | |||
|
|||
// PUT /publish/:prefix/:distribution | |||
// @Summary Update published repository |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make bold
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
copy multi line description from https://www.aptly.info/doc/api/publish/,
ok, so the change here is that we also allow local repos. adding new snapshots was already possible in that since, right ?
I think add/remove is better.
what I fail to wrap my head around: with aptly commands we have publish update and publish switch. In the API both are done with the PUT ? What is the difference between switch and update ?
I would not change existing behavior, therefore just adding /remove is the least invasive. We can still add /add later. Only the documentation needs to be updated (and hopefully bring some clarity about switch/update/remove). Maybe you can have a look at #1352 and #1162, if we merge them first and rebase your PRs, we have a good base for the pipeline and documentation... |
Before we started, you had to define all components you want to have in your published repository at creation time. Afterwards, it was not possible to add or remove components from a published repository of any kind (snapshot or local). Adding or removing requires dropping the published repository and recreating it by which the new component set. That means the component set of a published repository was immutable and could not be modified after creation. The For example, we have defined a mirror of all packages in the What we are currently trying to achieve is, that Aptly offers a way to modify the component set after creation time by adding and removing components and by associating them with snapshots or local repositories, respectively. The following use case were not supported before our changes:
|
A snapshot is an immutable package set. Calling However, in case of a local repository someone could have added or removed packages. In order to make them accessible from the outside, you must advice the corresponding published local repository to re-fetch the package set from the backed local repositories ( The two commands have in common that they influence the package set of a published repository. But there is no other functional relationship between them. |
Summary:
Maybe it is possible to add a new subcommand group to publish, but we loose backward compatibility for
|
That would be an alternative REST-API but it is not so RESTful, because we actually model actions and it has the problem, that
or
We model Inspired by:
What do you think? Maybe we can keep the old way to switch a snapshot of a published snapshot repository for some time by using |
Fixes #1355, #1338
Description of the Change
This commit modifies the behavior of the publish
switch
method in the way, that it can also be used to add/update components of published local repositories. Furthermore, the commit ensures that the sources returned by a published repository are ordered by their component names.Checklist
AUTHORS