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

Automate Configuration Migrations #1502

Closed
ghost opened this issue Feb 9, 2018 · 12 comments · Fixed by #15122
Closed

Automate Configuration Migrations #1502

ghost opened this issue Feb 9, 2018 · 12 comments · Fixed by #15122
Assignees
Labels
priority-2-high Bugs impacting wide number of users or very important features status:in-progress Someone is working on implementation type:feature Feature (new functionality)

Comments

@ghost
Copy link

ghost commented Feb 9, 2018

Recently I've noticed the following output for a few projects using an on-premise deployment of Renovate:

INFO: Config migration necessary (repository=example-project)
      "oldConfig": {
        "extends": [
          ":separateMajorReleases",
          ":prImmediately",
          ":renovatePrefix",
          ":semanticPrefixFixDepsChoreOthers",
          ":updateNotScheduled",
          ":automergeDisabled",
          ":maintainLockFilesDisabled",
          ":autodetectPinVersions",
          "group:monorepos",
          "helpers:oddIsUnstablePackages"
        ],
        "pinVersions": false,
        "semanticCommits": true,
        "timezone": "US/Central",
        "baseBranch": "development",
        "schedule": ["after 8am and before 5pm on sunday"]
      },
      "newConfig": {
        "extends": [
          ":separateMajorReleases",
          ":prImmediately",
          ":renovatePrefix",
          ":semanticPrefixFixDepsChoreOthers",
          ":updateNotScheduled",
          ":automergeDisabled",
          ":maintainLockFilesDisabled",
          ":autodetectPinVersions",
          "group:monorepos",
          "helpers:oddIsUnstablePackages"
        ],
        "pinVersions": false,
        "semanticCommits": true,
        "timezone": "US/Central",
        "schedule": ["after 8am and before 5pm on sunday"],
        "baseBranches": ["development"]
      }

It looks like the property baseBranches changed.

Would it be possible to have Renovate automate the process of upgrading a project's configuration for these minor changes?

Perhaps submitting a pull request with the new, migrated, configuration. Also auto-accept in the event that the change is non-breaking, and status checks pass?

@ghost ghost changed the title Automating Minor Configuration Updates Automate Minor Configuration Updates Feb 9, 2018
@rarkins
Copy link
Collaborator

rarkins commented Feb 9, 2018

It’s definitely my plan to raise a PR for this, but I want to review quite a few logs first to make sure they’re right. I know of one bug with it for instance (empty errors array gets appended sometimes). For the app I probably won’t make automerge the default but it could be configurable for self hosted users to enable.

@ghost
Copy link
Author

ghost commented Feb 9, 2018

We definitely have a small, but growing number, of repositories with minor configuration changes indicated by Renovate.

Our hope is to keep our overhead low on the side of the team deploying Renovate, and to be consistent in how we communicate configuration changes (through automated PRs).

Having it off by default would be fine with me, as it would be easy enough to enable in our on-premise deployment.

@rarkins rarkins added type:feature Feature (new functionality) ready priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others labels Mar 3, 2018
@rarkins rarkins self-assigned this Apr 1, 2018
@rarkins rarkins changed the title Automate Minor Configuration Updates Automate Minor Configuration Migration Jul 5, 2018
@rarkins rarkins changed the title Automate Minor Configuration Migration Automate Configuration Migrations Aug 23, 2018
@rarkins rarkins removed the ready label Jun 18, 2020
@HonkingGoose
Copy link
Collaborator

@rarkins You said in PR #10426:

We've generally kept migrations "forever". We really should implement the config migration PR so that in future we can remove migrations after a reasonable time.

Maybe you want to bump the priority of this issue to priority-2-important?

@rarkins rarkins added priority-2-high Bugs impacting wide number of users or very important features and removed priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others labels Jun 14, 2021
@rarkins rarkins added status:blocked Issue is blocked by another issue or external requirement and removed status:ready labels Dec 11, 2021
@rarkins
Copy link
Collaborator

rarkins commented Dec 11, 2021

For now I'm classifying this as status:blocked because I want to complete the refactoring of migration code first, so that key ordering is preserved as much as possible. Without it, migration PRs will be harder to read.

@rarkins
Copy link
Collaborator

rarkins commented Mar 12, 2022

Blocked by #11459

@rarkins rarkins removed their assignment Mar 12, 2022
@rarkins rarkins added status:ready and removed status:blocked Issue is blocked by another issue or external requirement labels Mar 14, 2022
@rarkins
Copy link
Collaborator

rarkins commented Mar 14, 2022

I think this can be unblocked now, and we should release it using a feature flag migrateConfigurations, which defaults to false.

@rarkins
Copy link
Collaborator

rarkins commented Mar 14, 2022

The branch name should be {{{branchPrefix}}}migrate-config.

@Gabriel-Ladzaretti Gabriel-Ladzaretti self-assigned this Apr 7, 2022
@Gabriel-Ladzaretti
Copy link
Collaborator

Gabriel-Ladzaretti commented Apr 13, 2022

I've did some research and fiddled around.

One approach I tried was to hook into the main flow of renovate with custom manager, datasource and versioning.
Configuration entry is treated as a dependency and the value as a version, and using the replacementName and replacementVersion mechanism to update it.

This approach happens to be quite cumbersome , as the migrated config can have deleted lines or renamed value pairs and a lot of extra housekeeping is needed for this one to work.

one other solution is to simply write to a file the updated migrated config and create a PR for it.
in this approach parsing is not needed and user's indention might be overwritten.

Would appreciate your input on this and as to how to proceed further

@rarkins
Copy link
Collaborator

rarkins commented Apr 13, 2022

We can detect the user's indentation. There's already a library for this which we use in a couple of places.

@Gabriel-Ladzaretti
Copy link
Collaborator

This is only a POC, there is still much to be done.
but we are getting somewhere
https://github.com/ladzaretti/config-migration/pull/3/files

done via the manager -> datasource -> versioning route

@rarkins
Copy link
Collaborator

rarkins commented Apr 13, 2022

I think this might be over complicating things. We just want a standalone PR similar to how onboarding ones are done. Unrelated to managers, datasources and versioning

@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 32.90.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority-2-high Bugs impacting wide number of users or very important features status:in-progress Someone is working on implementation type:feature Feature (new functionality)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants