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: Create Plugin updates as migrations #1479

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jackw
Copy link
Collaborator

@jackw jackw commented Jan 24, 2025

What this PR does / why we need it:

This PR introduces the building blocks to allow developers to write migrations, focused on a specific update task, which are run sequentially via the create-plugin update command. This is hidden behind a flag --experimental-updates which should allow us to iterate further on this without impacting current usage.

See epic for more info and design doc for even more more info.

Read more about how to add migrations in the CONTRIBUTION guide →

Which issue(s) this PR fixes:

Related #1254

📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @grafana/create-plugin@5.14.0-canary.1479.4200106.0
# or 
yarn add @grafana/create-plugin@5.14.0-canary.1479.4200106.0

Copy link

github-actions bot commented Jan 24, 2025

Hello! 👋 This repository uses Auto for releasing packages using PR labels.

✨ This PR can be merged and will trigger a new minor release.
NOTE: When merging a PR with the release label please avoid merging another PR. For further information see here.

Co-authored-by: Jack Westbrook <jack.westbrook@gmail.com>
Co-authored-by: Levente Balogh <balogh.levente.hu@gmail.com>
@leventebalogh leventebalogh force-pushed the updates-as-migrations-pt1 branch from 6b6203b to a0b402b Compare January 27, 2025 10:55
@leventebalogh leventebalogh added minor Increment the minor version when merged release Create a release when this pr is merged labels Jan 27, 2025
@leventebalogh leventebalogh marked this pull request as ready for review January 27, 2025 11:01
@leventebalogh leventebalogh requested a review from a team as a code owner January 27, 2025 11:01
@leventebalogh leventebalogh requested a review from mckn January 27, 2025 11:01
Copy link
Collaborator

@mckn mckn left a comment

Choose a reason for hiding this comment

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

Great work on this! Looks really great 🙌🏻 I have some thoughts follow up questions.

  • Have you considered having two functions as part of the migration script. One that does the migration and another one that checks if the migration is applicable. Then in the migration manager we could check if a migration is applicable prior to running it. Benefit would be so that you can skip a migration e.g. if the current plugin doesn't have/use that part of the scaffolded plugin.
  • Instead of having the version could we just have an array of migrations? Then they will automatically be ordered and you can use the function that checks if a migration is applicable to check version compatibility.
  • What is the thoughts regarding applying changes to the create-plugin. Are we planning on using migrations to change the create-plugin project as well?

content: `(This check is necessary to make sure that the updates are easy to revert and don't mess with any changes you currently have.
if (!(await isGitDirectoryClean()) && !argv.force) {
printRedBox({
title: 'Please clean your repository working tree before updating.',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice addition to this feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged release Create a release when this pr is merged
Projects
Status: 🔬 In review
Development

Successfully merging this pull request may close these issues.

3 participants