-
Notifications
You must be signed in to change notification settings - Fork 293
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
Fixes #37989 - More APIs and remote repository mirroring action #11207
base: master
Are you sure you want to change the base?
Conversation
3f2cdfa
to
03254ae
Compare
03254ae
to
e5cbc22
Compare
app/controllers/katello/api/v2/flatpak_remote_repositories_controller.rb
Show resolved
Hide resolved
app/views/katello/api/v2/flatpak_remote_repositories/show.json.rabl
Outdated
Show resolved
Hide resolved
e5cbc22
to
ba99139
Compare
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.
The only remaining things I see not working are the manifests=false param and mirroring via the API.
app/controllers/katello/api/v2/flatpak_remote_repositories_controller.rb
Outdated
Show resolved
Hide resolved
ba99139
to
fcf9450
Compare
The 2 issues should now be resolved. Ended up removing model perms for remote_repositories and relying completely on remote permissions to avoid having multiple permissions for the related objects. Mirror will need |
What are the changes introduced in this pull request?
Add API endpoints for remote repositories, manifests and introduce the remote repository mirroring action which mirrors the remote repository into a katello repository.
Considerations taken when implementing this change?
Added a registry_url on remote object cause remote url != registry URL.
What are the testing steps for this pull request?
Run bundle exec rails db:migrate to migrate db
Run following to create 2 remotes, one pointing to redhat flatpak index and another at fedora flatpak index:
Run the below actions to scan the 2 indexes and you should have 2 successful actions in your foreman tasks.
#Sync redhat flatpak:
redhat_remote = Katello::FlatpakRemote.find_by(name: "Redhat flatpak")
ForemanTasks.sync_task(::Actions::Katello::Flatpak::ScanRemote, redhat_remote)
#Sync fedora flatpak:
fedora_remote = Katello::FlatpakRemote.find_by(name: "Fedora flatpak")
ForemanTasks.sync_task(::Actions::Katello::Flatpak::ScanRemote, fedora_remote)
API:
Remotes:
https://centos9-katello-devel.sajha.example.com/katello/api/v2/flatpak_remotes/
Remote repository:
https://centos9-katello-devel.sajha.example.com/katello/api/v2/flatpak_remotes/5/flatpak_remote_repositories/
Remote repository with manifests:
https://centos9-katello-devel.sajha.example.com/katello/api/v2/flatpak_remotes/5/flatpak_remote_repositories/1059?manifests=true
Now you can mirror the repo into Katello by providing remote repo id and a product id:
To mirror a remote repository:
Console:
product = Katello::Product.custom.last
firefox_repository = Katello::FlatpakRemoteRepository.find_by(name: "rhel9/firefox-flatpak")
ForemanTasks.sync_task(::Actions::Katello::Flatpak::MirrorRemoteRepository, firefox_repository, product)
Now sync the new repo and verify that everything looks sane.
Testing permissions:
All of the above steps should work for the admin user and the console admin.
If you create a new user role, they'll need flatpak_remote_permissions : view_flatpak_remotes, create_flatpak_remotes and edit_flatpak_remotes to do actions on remotes.
To mirror remote repos, i.e, create katello repos from remote repo, you need to have the edit_product permission.