Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

PluginUpgradeTask in Jira doesn't execute

KL Kumar
Contributor
May 24, 2021

Hi,

I am writing a Jira server plugin where I have a requirement to do a particular execution while plugin is installing. I have used PluginUpgradeTask concept, but this is not being executed on plugin deployment. Below is my code.

I am unsure what mistake am I doing.

public abstract class AbstractUpgradeTask implements PluginUpgradeTask{
@Override
public String getPluginKey() {
Bundle bundle = FrameworkUtil.getBundle(AbstractUpgradeTask.class);
return OsgiHeaderUtil.getPluginKey(bundle);
}
}
@Component
@ExportAsService(PluginUpgradeTask.class)
public class LoadConfig extends AbstractUpgradeTask {
@ComponentImport
private final PluginSettingsFactory pluginSettingsFactory;

@Autowired
public LoadConfig(PluginSettingsFactory pluginSettingsFactory) {
this.pluginSettingsFactory = pluginSettingsFactory;
}

@Override
public Collection<Message> doUpgrade() throws Exception {
System.out.println("=============================================> "+doUpgrade);
log.warn("doUpgrade");
}

@Override
public int getBuildNumber() {
// TODO Auto-generated method stub
return 1;
}

@Override
public String getPluginKey() {
// TODO Auto-generated method stub
return null;
}

@Override
public String getShortDescription() {
return "This upgrade task";
}
}

Best Regards,

Kumar

1 answer

0 votes
Gareth Cantrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 25, 2021

Hi @KL Kumar 

It seems you're not returning anything from the getPluginKey() method. As the SAL tracks successful upgrades, at a minimum it will need to to know both the plugin key and build number.

I'd also recommend continuing this discussion on the Developer Community (https://community.developer.atlassian.com/) where they'll be better able to assist with queries such as this.

KL Kumar
Contributor
May 25, 2021

Hi @Gareth Cantrell 

I tried returning the plugin key for getPluginKey() method. But no luck.

I raised this in developer community too and waiting for some help from the community.

Thank you!

Gareth Cantrell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 25, 2021

@KL Kumar I was taking a look around and found this answer in another thread about plugin upgrades.

It points to a Git repo with examples, maybe it'll give you some insight. 

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events