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

remove repo after sync #1268

Merged
merged 9 commits into from
Jan 13, 2025
Merged

remove repo after sync #1268

merged 9 commits into from
Jan 13, 2025

Conversation

paragjain0910
Copy link
Contributor

@paragjain0910 paragjain0910 commented Jan 3, 2025

Description

When there is a repository removed in SCC from a product, it should also get removed from the product in RMT.

How to test

Glue : Remove repository from any product using rails console.

- rails c
- repository = Repository.find(id)
- repository.destroy

In Rmt : Do sync

- bin/rmt-cli sync
Expected behaviour

The sync process will remove any repositories that:

  • Are not present in the current SCC data
  • Have a non-null scc_id
  • Custom repositories (null scc_id) will be preserved

Repository dissassociation:

Delete association entry from the repositories_services table in glue db and then sync and same should reflect in rmt as well ( in the repositories_services rmt db).

Change Type

Please select the correct option.

  • Bug Fix (a non-breaking change which fixes an issue)
  • New Feature (a non-breaking change which adds new functionality)
  • Documentation Update (a change which only updates documentation)

Checklist

Please check off each item if the requirement is met.

  • I have reviewed my own code and believe that it's ready for an external review.
  • I have provided comments for any hard-to-understand code.
  • I have documented the MANUAL.md file with any changes to the user experience.
  • If my changes are non-trivial, I have added a changelog entry to notify users at package/obs/rmt-server.changes.

Review

Please check out our review guidelines
and get in touch with the author to get a shared understanding of the change.

lib/rmt/scc.rb Outdated Show resolved Hide resolved
… RepositoryService#create_repository! to RepositoryService#update_or_create_repository for better readability of the code flow.
@digitaltom
Copy link
Member

digitaltom commented Jan 3, 2025

The current branch has 2 test failures in

rspec ./spec/lib/rmt/scc_spec.rb:300
rspec ./spec/lib/rmt/scc_spec.rb:308

The current patch removes repositories globally if they're no more present in SCC. That's good, but potentially doesn't cover all use cases, like:
When a repository gets (in SCC) disassociated from a product A, but is still present on another product B. In this case the current code would not remove it from product A. To achieve this, we'd need to implement additional repo disassociation in https://github.com/SUSE/rmt/blob/remove_repo_after_syncn/lib/rmt/scc.rb#L206

@paragjain0910
Copy link
Contributor Author

paragjain0910 commented Jan 7, 2025

The current branch has 2 test failures in

rspec ./spec/lib/rmt/scc_spec.rb:300 rspec ./spec/lib/rmt/scc_spec.rb:308

The current patch removes repositories globally if they're no more present in SCC. That's good, but potentially doesn't cover all use cases, like: When a repository gets (in SCC) disassociated from a product A, but is still present on another product B. In this case the current code would not remove it from product A. To achieve this, we'd need to implement additional repo disassociation in https://github.com/SUSE/rmt/blob/remove_repo_after_syncn/lib/rmt/scc.rb#L206

added the logic for repository dissassociation.

lib/rmt/scc.rb Outdated Show resolved Hide resolved
lib/rmt/scc.rb Outdated Show resolved Hide resolved
lib/rmt/scc.rb Outdated Show resolved Hide resolved
@digitaltom digitaltom added the 2.21 label Jan 9, 2025
lib/rmt/scc.rb Outdated Show resolved Hide resolved
Copy link
Member

@digitaltom digitaltom left a comment

Choose a reason for hiding this comment

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

👍

@paragjain0910 paragjain0910 merged commit 9444e3f into master Jan 13, 2025
3 checks passed
@paragjain0910 paragjain0910 deleted the remove_repo_after_syncn branch January 13, 2025 11:39
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.

3 participants