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

Add galaxy v3 support, refactor, other fixes #104

Merged
merged 48 commits into from
Oct 8, 2023
Merged

Conversation

briantist
Copy link
Owner

@briantist briantist commented Oct 6, 2023

Related #102
Related #99 (as of this PR we now override proxied requests to always request 100 results, but we still don't support true pagination).

Fixes #23
Fixes #103
Fixes #100

Large PR to add galaxy v3 support.

There's a bunch of other small fixes, enhancements, and changes here too.

There's a fair amount of refactoring. I wanted to do even more, and maybe come up with a more generalized view system so there won't be so much repetition between v2 and v3 but it was taking too long, and I need to get working v3 support out with the public galaxy switchover, so maybe that will happen another time.

This will add support both for serving over v3 and proxying upstream v3.

Proxying requests from v2 API client calls to upstream v3 or vice-versa is not supported. No translation will be done; the client request's API version must be supported by the upstream you choose.

This should end up ok because galaxy v3 is supported all the way back to ansible-galaxy in 2.9. I don't think I'll ever implement proxy translation, but possible ways to do that:

  • use a real galaxy client in the upstream functionality instead of URL substitution
    • I considered taking a dependency on ansible-core and using its galaxy client (not supported, probably not a good idea); I'm not sure if it would actually be useful or provide the right methods either
    • I considered taking a dependency on antsibull-core and using its custom galaxy client, but it's all async and galactory is not (yet) which makes it kind of a pain to use; even still I'm not sure if provides the right methods
  • Do a lot of conditional translation in both the URL substitution and response handling, making this stuff much more complicated (creating our own client, reinventing the wheel yet again)
  • Support multiple upstreams (per api version? fallbacks? etc)

@briantist briantist added this to the v0.11.0 milestone Oct 6, 2023
@briantist briantist self-assigned this Oct 6, 2023
@codecov
Copy link

codecov bot commented Oct 6, 2023

Codecov Report

Attention: 160 lines in your changes are missing coverage. Please review.

Comparison is base (d1af360) 56.77% compared to head (96541ae) 61.58%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #104      +/-   ##
==========================================
+ Coverage   56.77%   61.58%   +4.81%     
==========================================
  Files          27       32       +5     
  Lines        1011     1463     +452     
==========================================
+ Hits          574      901     +327     
- Misses        437      562     +125     
Files Coverage Δ
galactory/api/__init__.py 100.00% <100.00%> (ø)
galactory/api/v2/collection_imports.py 100.00% <100.00%> (ø)
galactory/api/v3/__init__.py 100.00% <100.00%> (ø)
galactory/api/v3/collection_imports.py 100.00% <100.00%> (ø)
galactory/constants.py 100.00% <100.00%> (ø)
galactory/models.py 100.00% <100.00%> (ø)
tests/unit/client/test_api.py 100.00% <100.00%> (ø)
tests/unit/models/conftest.py 100.00% <100.00%> (ø)
tests/unit/models/test_collectioncollection.py 100.00% <100.00%> (ø)
tests/unit/models/test_collectiondata.py 100.00% <100.00%> (ø)
... and 8 more

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@briantist briantist added bug Something isn't working enhancement New feature or request dependencies Pull requests that update a dependency file python Pull requests that update Python code labels Oct 8, 2023
@briantist briantist marked this pull request as ready for review October 8, 2023 17:21
@briantist briantist merged commit 87bc15b into main Oct 8, 2023
11 checks passed
@briantist briantist deleted the views/refactor branch October 8, 2023 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file enhancement New feature or request python Pull requests that update Python code
Projects
None yet
1 participant