-
-
Notifications
You must be signed in to change notification settings - Fork 227
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
Added confirmation/support for automatically rolling back to previous version #773
Added confirmation/support for automatically rolling back to previous version #773
Conversation
lib/commands/update.js
Outdated
rollbackFromFail(error, argv) { | ||
const previousVersion = this.system.getInstance().cliConfig.get('previous-version'); | ||
this.ui.error(error); | ||
const question = argv.version === '2.0.0' ? |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
lib/commands/update.js
Outdated
} | ||
|
||
return this.run({ | ||
rollback: true |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
lib/commands/update.js
Outdated
@@ -179,6 +181,25 @@ class UpdateCommand extends Command { | |||
}); | |||
} | |||
|
|||
rollbackFromFail(error, argv) { | |||
const previousVersion = this.system.getInstance().cliConfig.get('previous-version'); | |||
this.ui.error(error); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
1c818db
to
3c73204
Compare
@kirrg001 updated the error message, still not sure how we should handle the error |
@vikaspotluri123 I'll take a look at this PR tomorrow :) Will also look at the error handling. |
35465d9
to
71d49f6
Compare
Tests have been added! |
I have to test two cases: A: You want to migrate and an error occurs during the migration. |
Tomorrow! 👻 |
71d49f6
to
53e4ccf
Compare
lib/commands/update.js
Outdated
const question = `Unable to upgrade Ghost from v${oldVer} to v${newVer}. Would you like to revert back to v${oldVer}?`; | ||
const promise = force ? Promise.resolve(true) : this.ui.confirm(question, true); | ||
|
||
this.ui.error(error); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
lib/commands/update.js
Outdated
rollbackFromFail(error, newVer, force = false) { | ||
const oldVer = this.system.getInstance().cliConfig.get('previous-version'); | ||
const question = `Unable to upgrade Ghost from v${oldVer} to v${newVer}. Would you like to revert back to v${oldVer}?`; | ||
const promise = force ? Promise.resolve(true) : this.ui.confirm(question, true); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
lib/commands/update.js
Outdated
@@ -114,7 +114,9 @@ class UpdateCommand extends Command { | |||
return; | |||
} | |||
|
|||
return this.ui.listr(tasks, context); | |||
return this.ui.listr(tasks, context).catch(error => | |||
this.rollbackFromFail(error, context.version, argv['auto-rollback']) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
return Promise.resolve(); | ||
} | ||
|
||
return this.run({ |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -195,6 +197,24 @@ class UpdateCommand extends Command { | |||
}); | |||
} | |||
|
|||
rollbackFromFail(error, newVer, force = false) { |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@@ -114,7 +114,9 @@ class UpdateCommand extends Command { | |||
return; | |||
} | |||
|
|||
return this.ui.listr(tasks, context); |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
I'll push changes in a bit. |
59fba4f
to
435ad4d
Compare
refs TryGhost#759 - ask user if we wants to bring back previous version if - GhostError was thrown (migration failed) - if the user has not executed `ghost update --rollback` - show error to user so he knows why the update failed
refs TryGhost#759 - return a proper GhostError when migration fails - detect if knex-migrator can't find versions to rollback (resolve in this case)
435ad4d
to
a4b68ca
Compare
I am doing a final test, then i'll merge this into 1.9. |
refs #759
The wording won't work because I want to rebase on #772 and #771 before finalizing how the function will work