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

⚠️ Use the new seeding library to seed rulesets #450

Merged
merged 2 commits into from
Jul 21, 2023

Conversation

mansam
Copy link
Collaborator

@mansam mansam commented Jul 21, 2023

  • Migration v7 sets up the new unique UUID columns and deletes the old RuleSets
  • For the time being, the seeds are cloned into the Hub image from the tackle2-seed repository.
  • Seeds only run if the version number in the seed document matches the DB migration version
  • Seeds only run if the seed digest differs from that stored in the .hub.db.seed setting.

Seeding operates via the following logic:

  • If a model with the same UUID as a seed resource exists, check if it is being renamed. If it is being renamed, ensure that the target name is free by renaming any model that already has that name. Then proceed to update the original model.
  • If a model with the same UUID does not exist, look to see if one with the same name already exists.
    • If one does not already exist, create a new model.
    • If one already exists and it was not created by the Hub (CreateUser != ""), rename it to free up the name and then create a new model.
    • If one already exists and it was created by the Hub (CreateUser == ""), commandeer it.

@mansam mansam requested a review from jortel July 21, 2023 02:13
@mansam mansam changed the title Use the new seeding library to seed rulesets ⚠️ Use the new seeding library to seed rulesets Jul 21, 2023
Signed-off-by: Sam Lucidi <slucidi@redhat.com>
Signed-off-by: Sam Lucidi <slucidi@redhat.com>
Copy link
Contributor

@jortel jortel left a comment

Choose a reason for hiding this comment

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

Looks great, Sam.

@mansam mansam merged commit 4686a21 into konveyor:main Jul 21, 2023
8 of 9 checks passed
aufi added a commit that referenced this pull request Jul 26, 2023
API tests failed on Ruleset empty seed check. Removing Ruleset seed
check for now (until we have tackle2-seed related test requirements).

```
=== RUN   TestRuleSetListSeed
time=2023-07-25T09:37:02+02:00 level=info msg=[binding] |200|  GET /rulesets
    api_test.go:83: Seed looks empty, but it shouldn't.
--- FAIL: TestRuleSetListSeed (0.00s)
```

Related to #450 and
https://github.com/konveyor/tackle2-seed

Signed-off-by: Marek Aufart <maufart@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants