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

feat(config): migrate inline with the same sort #12091

Merged
merged 39 commits into from Nov 17, 2021

Conversation

pret-a-porter
Copy link
Contributor

Changes:

Refactor migrations to provide ability to migrate and save original order of properties in configuration

Context:

#11459

Documentation

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@rarkins
Copy link
Collaborator

rarkins commented Oct 9, 2021

Are you planning to rewrite every single migration rule in one go? I would prefer to avoid that if so - too much risk of missing something

@pret-a-porter pret-a-porter force-pushed the refactor/migrate_same_sort branch 3 times, most recently from 8d9a6b9 to aea61bd Compare October 9, 2021 18:12
@pret-a-porter
Copy link
Contributor Author

Are you planning to rewrite every single migration rule in one go? I would prefer to avoid that if so - too much risk of missing something

Nope, I guess in one go it will be too huge PR. If you agree with idea, I will move step by step.

@rarkins
Copy link
Collaborator

rarkins commented Oct 9, 2021

OK please get one step working first to demonstrate. I was hoping you would use the code I posted earlier which solves the majority of the problem in one go

@HonkingGoose
Copy link
Collaborator

From our Pull Request template:

Please do not force push to your PR's branch after you have created your PR, as doing so forces us to review the whole PR again.

This makes it harder for us to review your work because we don't know what has changed.

PRs will always be squashed by us when we merge your work. Commit as many times as you need in this branch.

lib/config/migrations/migration.ts Outdated Show resolved Hide resolved
lib/config/migrations/migrations-runner.ts Outdated Show resolved Hide resolved
lib/config/migrations/required-status-checks-migration.ts Outdated Show resolved Hide resolved
lib/config/migrations/index.ts Outdated Show resolved Hide resolved
@pret-a-porter
Copy link
Contributor Author

OK please get one step working first to demonstrate. I was hoping you would use the code I posted earlier which solves the majority of the problem in one go

https://github.com/renovatebot/renovate/pull/12091/files#diff-6c6bef2e9a0f4b1863006b6c796698bedb832302c1c56b147e6471ae043684eaR31 this test checks, that MigrationService saves original order of configuration properties

Also I have added examples for different migrations

@pret-a-porter pret-a-porter marked this pull request as ready for review October 14, 2021 21:34
@pret-a-porter
Copy link
Contributor Author

@rarkins
Copy link
Collaborator

rarkins commented Nov 7, 2021

image @rarkins I have tried to run against pret-a-porter-testing/renovate-reproduction-11459@main/renovate.json

When you test, it's best if you can include some non migrated config too, so that we can observe they are ordered correctly even if not migrated.

@pret-a-porter
Copy link
Contributor Author

pret-a-porter commented Nov 7, 2021

@rarkins sorry, I did not get it. I have created repository with non migrated config https://github.com/pret-a-porter-testing/renovate-reproduction-11459. On screenshot you can see lines with oldConfig and newConfig. Shall I do something else?

@rarkins
Copy link
Collaborator

rarkins commented Nov 7, 2021

@rarkins sorry, I did not get it. I have created repository with non migrated config pret-a-porter-testing/renovate-reproduction-11459. On screenshot you can see lines with oldConfig and newConfig. Shall I do something else?

Yes, you need to do something else. Every config option in newConfig has been migrated. You should test with a mix of migrated and non-migrated (does not need migration) config.

@pret-a-porter
Copy link
Contributor Author

pret-a-porter commented Nov 7, 2021

Screenshot 2021-11-07 at 15 41 25

@rarkins done

Also you can provide some more specific config for testing

@rarkins
Copy link
Collaborator

rarkins commented Nov 7, 2021

Can you put ignoreTests last and verify that it remains last?

@rarkins
Copy link
Collaborator

rarkins commented Nov 7, 2021

Actually, have a mix of non-migrated fields first, last and in the middle of migrated and verify ordering remains as expected

@pret-a-porter
Copy link
Contributor Author

image
@rarkins done as well

@pret-a-porter
Copy link
Contributor Author

@rarkins shall I do any other validations regarding this PR?

@rarkins
Copy link
Collaborator

rarkins commented Nov 12, 2021

image @rarkins done as well

This test doesn't interleave migrated and non-migrated. It has all migrated first, then non-migrated. Can you e.g. move versionScheme last in the old config?

@pret-a-porter
Copy link
Contributor Author

Screenshot 2021-11-13 at 21 44 06

@rarkins it works fine

@rarkins rarkins enabled auto-merge (squash) November 17, 2021 15:35
@rarkins rarkins merged commit 5377b1f into renovatebot:main Nov 17, 2021
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 29.12.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 18, 2021
@pret-a-porter pret-a-porter deleted the refactor/migrate_same_sort branch January 11, 2022 20:28
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants