Skip to content
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

Conversation

cfiehe
Copy link

@cfiehe cfiehe commented Oct 2, 2024

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

@cfiehe cfiehe force-pushed the feature/allow_add_component_to_published_repo_for_local_repo branch 4 times, most recently from 0d96e4b to 18ffde2 Compare October 2, 2024 20:27
@neolynx
Copy link
Member

neolynx commented Oct 2, 2024

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) ;-)

@cfiehe cfiehe force-pushed the feature/allow_add_component_to_published_repo_for_local_repo branch from 18ffde2 to bcab28d Compare October 2, 2024 21:21
@cfiehe
Copy link
Author

cfiehe commented Oct 2, 2024

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.

@cfiehe cfiehe force-pushed the feature/allow_add_component_to_published_repo_for_local_repo branch 4 times, most recently from 9c64533 to eb6acfd Compare October 2, 2024 22:49
@neolynx
Copy link
Member

neolynx commented Oct 2, 2024

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 !

@neolynx
Copy link
Member

neolynx commented Oct 2, 2024

I dont have the rights to push to your branch, but here would be the golang-lint fix: eb15a65 :-)

@neolynx
Copy link
Member

neolynx commented Oct 2, 2024

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

@cfiehe cfiehe force-pushed the feature/allow_add_component_to_published_repo_for_local_repo branch 2 times, most recently from 1924941 to e97725c Compare October 3, 2024 06:27
@cfiehe
Copy link
Author

cfiehe commented Oct 3, 2024

@neolynx
Have you got an idea, why the test execution is failing?

--- PASS: Test (0.01s)
PASS
coverage: 74.9% of statements
ok  	github.com/aptly-dev/aptly/utils	0.011s	coverage: 74.9% of statements
FAIL

Stopping etcd ...

Unit Tests FAILED

@cfiehe cfiehe force-pushed the feature/allow_add_component_to_published_repo_for_local_repo branch from e97725c to 744c0d9 Compare October 3, 2024 07:00
@cfiehe
Copy link
Author

cfiehe commented Oct 3, 2024

I dont have the rights to push to your branch, but here would be the golang-lint fix: eb15a65 :-)

Ok, that is strange. The flag that the maintainer has editing rights is set.

@cfiehe cfiehe force-pushed the feature/allow_add_component_to_published_repo_for_local_repo branch 8 times, most recently from 1a9638b to 584146f Compare October 3, 2024 13:17
@neolynx
Copy link
Member

neolynx commented Oct 3, 2024

coverage 76.85% of diff hit (target 74.90%)

nice !

@neolynx neolynx added the needs review Ready for review & merge label Oct 3, 2024
@cfiehe
Copy link
Author

cfiehe commented Oct 3, 2024

It finally turns into green 😅. Thanks a lot for your support.

@neolynx neolynx added the WIP label Oct 5, 2024
@cfiehe cfiehe force-pushed the feature/allow_add_component_to_published_repo_for_local_repo branch 21 times, most recently from 8580703 to b908730 Compare October 5, 2024 21:49
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 <[email protected]>
@cfiehe cfiehe force-pushed the feature/allow_add_component_to_published_repo_for_local_repo branch from b908730 to de05ea3 Compare October 5, 2024 21:51
@cfiehe
Copy link
Author

cfiehe commented Oct 5, 2024

I have implemented the new publish add command and used the same CLI style, which is used for publish switch. add succeeds only when the component does not already exist in the published repository. I have modified the publish switch command, so that you can also switch the local repositories of a published local repository. The manual might need an extension.

I have simplified the REST API and introduced the new Sources attribute. Now a simple PUT with the entire source list triggers the update of the published repository. The only drawback is that in most cases the client needs to query the resource first in order to get the full source list. With the new published repository resource, which allows you to query a single published repository, the overhead becomes much smaller. In the next step, the source list is modified, so that it represents the entire target state. Sources, which are not in the list, but exist in the published repository, are removed. I think this approach is more RESTful and fits best in Aptly's REST API. There is still the possibility to add something in the future, which is smarter and may avoid the GET request.

In the next day, I will have a look at the (Swagger) documentation and add/update what is missing.

@@ -452,8 +456,26 @@ func (p *PublishedRepo) UpdateLocalRepo(component string) {
p.rePublishing = true
}

// UpdateSnapshot switches snapshot for component
func (p *PublishedRepo) UpdateSnapshot(component string, snapshot *Snapshot) {
// UpsertLocalRepo inserts/updates local repository source for component
Copy link
Member

Choose a reason for hiding this comment

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

typo

@neolynx neolynx removed the needs review Ready for review & merge label Oct 8, 2024
@neolynx
Copy link
Member

neolynx commented Oct 9, 2024

shall we close this in favor of #1366 ?

@neolynx
Copy link
Member

neolynx commented Oct 14, 2024

closing in favor of #1366

@neolynx neolynx closed this Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow to add/update components of a published local repository
2 participants