-
-
Notifications
You must be signed in to change notification settings - Fork 74
Preserving configs when upgrading from stash 3.x to bitbucket 4.x #122
Comments
There is code for that. That should migrate old settings automatically when upgrading the plugin. Can you see anything interesting in the logs when upgrading? Maby a stacktrace? Perhaps search for "looking for legacy settings". |
* Did not save loaded legacy settings in new format when found. Got new UUID:s on every load.
Should now be fixed in 2.23. You will need to remove the new storage key for 2.18+ |
Thank you very much Tomas! I will give this a try on Monday. |
Thanks Tomas, I am Joey, I work with @kashyap-parikh. We tried another test run of upgrading to bitbucket 4.6.1 and just an upgrade to plugin v2.23 within stash v3.11.1 - The following are out findings: _In current stash version 3.11.1 - upgrading to pull-request-notifier-for-stash 1.38 was stable and did not blow away the plugin configs Upgrading from Stash 3.11.1 to bitbucket 4.6.1 blows away pull-request-notifier-for-stash configuration after upgrading to plugin version 2.23 Educated guess is that major upgrade from stash to bitbucket (including mysql schema changes) possibly drops database tables containing plugin data._ Is there a way to extract/export/backup/save pull-request-notifier-for-stash configuration data before upgrading the stash application to bitbucket? If not, what options are available to use to maintain the configuration data over the course of the upgrade? |
I changed the settings format. When the plugin is installed in Bitbucket Server, it will look for legacy settings (se.bjurr.prnfb.admin.AdminFormValues_2) and load them if available and if the new settings (se.bjurr.prnfb.pull-request-notifier-for-bitbucket-3) are not available. There is an editor, Plugin Data Editor (https://marketplace.atlassian.com/archive/com.atlassian.plugins.plugin-data-editor). But it can only export settings. I'm not sure how to import settings, I asked a question here: |
I have verified that plugin configuration from pull-request-notifier-for-stash is not persisted when upgrading to pull-request-notifier-for-bitbucket v2.23. I attempted to manually extract the admin.vm from the original stash .jar and update the file admin.vm in the bitbucket .jar. this brought over some of the data, but not all of it. |
You may try version 2.17. It has the same GUI and settings format as used in Stash. Were you able to use the Plugin Data Editor? Is the old key available after upgrade? Is the new key available? |
After the bitbucket upgrade, there is no option to use an old stash version of the plugin until it has been upgraded. What is the key for? Can it be migrated from one version to another? --Joey Success is the best revenge
|
You can install 2.17 in Bitbucket Server by downloading it manually from: And then uploading it in the admin GUI of Bitbucket Server. In you case it may be a good idea have 2.17 working. And then as long as the settings key |
I can confirm that downgrading to v2.17 does restore the configuration, and that 2.18 is the point where we lose the configuration. Are there any plans to fix this in future releases of this plugin? |
What you need to do is remove the settings key |
Where do i remove this key? The only place I was able to find it referenced in the .jar is in se/bjurr/prnfb/service/SettingsService.class which is a binary file. |
It needs to be removed from the bitbucket server database. Im not sure how to do that. |
Ok, so this is where I am at... I have located 'se.bjurr.prnfb.pull-request-notifier-for-bitbucket-3' in the stash database table stash.key_name. All of the plugin data is located in in the matching 'key_vaule' field. If I remove 'se.bjurr.prnfb.pull-request-notifier-for-bitbucket-3', does this also remove the key_value? ...or are we just removing the the key_name and leaving the rest of that record as is? |
I think you can remove or rename that key. Then the plugin cant find the
|
After doing a little digging in the stash database, I found the table stash.plugin_setting. While the plugin_setting table stores plugin-specific configurations, it does such that each plugin has it's own record. The actual plugin configuration data is stored in a single 'key_value' field for it's respective record. Why this matters is that when the 'pull-request-notifier-for-stash' plugin is called for a specific PR notifier, the plugin has to read the entire plugin configuration and parse out that specific trigger's data from every trigger's data every for every trigger call. This is very inefficient and will only get worse over time as more and more triggers are added. A better solution for configurable plugins would be moving configurable plugin data to it's own table, or even more efficient - storing that data in a redis DB. Because the 'pull-request-notifier-for-stash' plugin is unsupported by Atlassian, I don't see this happening anytime in the future. This is not a developer issue, this is an Atlassian issue with the way they handle their plugins. Ultimately this will be an ongoing issue with any configurable plugin. Also, I don't think your suggestion of deleting/renaming the plugin key would work. Since there is only a single record for each plugin, I don't see how it would generate a new key for our exiting plugin db record, rather than just creating a new fresh plugin record, (essentially leaving our configuration orphaned). I'll test this to confirm, but do not expect it to work. |
Confirmed that removing/renaming the key does not resolve this issue. The data is persistent in the database, but not pulled into the plugin. The same key is regenerated when updating to both 2.18 and the current version 2.26. Plugin data is persistent in the database and reverting to version 2.17 restores the configuration data back to the plugin UI. |
Hey there, I can confirm the settings behaviour with 2.17 and the latest version :-/ is there any further suggestion to get the settings working after an stash to bitbucket update? Deleting the key in the @kashyap-parikh Do you had any luck so far? Cheers, |
Its not so hard to create a REST endpoint where a GET request forces the migration to be done. I'll do it when I find the time... And PR:s are welcome! =) |
It seems that after removing the old settings key |
Are you saying that the plugin does not work after upgrade? Or just that the old settings are not migrated? It the plugin does not work after upgrade, I would need to make that a priority. |
It seems that the urlencoding has changed or is no longer used. We are using an internal wrapper to post messages to different slack rooms e.g.:
In Stash 3 and the old plugins that seems urlencoded in the latest version we need have to change it to:
Except from this, everything is working fine :-) |
If you dont mind, maby you can document how you post to Slack rooms in the readme on same level as the Jenkins headline? |
I'll check, the way we post to slack is through an internal company gateway, but I can write a short info that its necessary to urlencode every special character in recent versions |
I have an ugly problem. I upgraded from bitbucket 4.x to bitbucket 4.10.0. All fine. How can I fix it ? Thank you. |
The original configuration is still applied? |
"The original configuration is still applied?" "If you add something new, it is not displayed?" Is it possible to deactive / disable the old configuration ? |
I wrote some hints on troubleshooting, under "Reporting issues" in the readme. The part about Developer tools is interesting here. Also the part about curl, what is the response of the rest-resources. Are you a system admin (not only admin)? And we are talking about the global admin page? |
Yes, I am sysadmin and have full access. BitBucket Browser plugin (bitbucket/plugins/servlet/restbrowser#/resource/prnfb-admin-1-0-settings/GET) delivers me: { (HTTP 200) P.S.: prnfb-admin-1-0-settings-notifications gives me an JSON-object with my "DEFAULT_PULL_REQUEST_TRIGGER" But the problem still exist, it is not displayed in the plugin configuration... argh ! |
The database is hidden behind API:s used by the plugin. So I dont know There are no exceptions in your logs on machine running Bitbucker Server? 2016-10-19 17:03 GMT+02:00 devalru [email protected]:
|
No exception, but this in the atlassian-bitbucket.log : BitBucket debug logging activated. P.S.: Had plugin version 2.17 installed before. |
There are some logging here: You should be able to see some of them, at least from the time when you first browsed to the plugin admin page after upgrade. |
Do you get any notifications when requesting |
prnfb-admin-1-0-settings-notifications gives me an JSON-object containing my "DEFAULT_PULL_REQUEST_TRIGGER" with trigger-events, url, uuid and so on. |
[ |
Could your issue be same as: #116 ? You need to select the notification/button in the dropdown menus. |
omg - yes that it is. Thank you very much. |
Only about 10% of the active installations using this plugin are still on 3.x. So I'm closing this one now as I dont see myself or anyone else putting any effort into this issue anymore. |
I have several PR notifier configurations spread over 25+ repositories. When I tried to upgrade from Stash to Bitbucket and upgrade this plugin it failed to carry over those configuration.
Is there way to preserve configs between 3.x to 4.x versions? or copy configs from old to new install to restore?
The text was updated successfully, but these errors were encountered: