Upgrade from Bamboo 5.9 fails on UpgradeTask5914

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Problem

Bamboo may fail to start successfully when upgrading from a Bamboo version earlier than 5.9 to a version later than 5.9. The logs show that it has failed in Upgrade Task 5914.

The following appears in the <Bamboo-home>/atlassian-bamboo.log

INFO [17-UpgradeTaskBackgroundThread:pool-32-thread-1] [AbstractUpgradeManager] ----------------------------------------------------------------------------------------------------------------------------------------
INFO [17-UpgradeTaskBackgroundThread:pool-32-thread-1] [AbstractUpgradeManager] 5914 : Turn plan branch monitoring setting into branch creation, branch removal cleanup, and inactivity branch removal. (post-bootstrap)
INFO [17-UpgradeTaskBackgroundThread:pool-32-thread-1] [AbstractUpgradeManager] ----------------------------------------------------------------------------------------------------------------------------------------
ERROR [17-UpgradeTaskBackgroundThread:pool-32-thread-1] [AbstractUpgradeManager] java.lang.NullPointerException
java.lang.NullPointerException
	at com.atlassian.bamboo.upgrade.tasks.v5_9.UpgradeTask5914UpdatePlanBranchMonitoringSettings$UpgradeTask5913HibernateCallback.getBuildConfiguration(UpgradeTask5914UpdatePlanBranchMonitoringSettings.java:58)
	at com.atlassian.bamboo.upgrade.tasks.v5_9.UpgradeTask5914UpdatePlanBranchMonitoringSettings$UpgradeTask5913HibernateCallback.doInHibernate(UpgradeTask5914UpdatePlanBranchMonitoringSettings.java:44)
	at org.springframework.orm.hibernate5.HibernateTemplate.doExecute(HibernateTemplate.java:383)
	at org.springframework.orm.hibernate5.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:349)
	at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate$1.doInTransaction(BambooTransactionHibernateTemplate.java:43)
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
	at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:35)
	at com.atlassian.bamboo.persistence.BambooTransactionHibernateTemplate.execute(BambooTransactionHibernateTemplate.java:40)
	at com.atlassian.bamboo.upgrade.tasks.v5_9.UpgradeTask5914UpdatePlanBranchMonitoringSettings.doUpgrade(UpgradeTask5914UpdatePlanBranchMonitoringSettings.java:28)
	at com.atlassian.bamboo.upgrade.AbstractUpgradeManager.runUpgradeTask(AbstractUpgradeManager.java:186)
	at com.atlassian.bamboo.upgrade.UpgradeManagerImpl.doUpgrade(UpgradeManagerImpl.java:133)
	at com.atlassian.bamboo.upgrade.UpgradeLauncher.lambda$upgradeAndStartBamboo$0(UpgradeLauncher.java:104)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at com.atlassian.bamboo.utils.BambooRunnables$1.run(BambooRunnables.java:48)
	at com.atlassian.bamboo.security.ImpersonationHelper.runWith(ImpersonationHelper.java:26)
	at com.atlassian.bamboo.security.ImpersonationHelper.runWithSystemAuthority(ImpersonationHelper.java:17)
	at com.atlassian.bamboo.security.ImpersonationHelper$1.run(ImpersonationHelper.java:41)
	at java.lang.Thread.run(Thread.java:748)
INFO [17-UpgradeTaskBackgroundThread:pool-32-thread-1] [AbstractUpgradeManager] Task 5914 completed successfully.
FATAL [localhost-startStop-1] [UpgradeLauncher] Upgrade task error: Task for build 5914 failed with exception: null

This error will be seen if there are Build plans that do not have any associated build definition.

The following SQL will list the Plan key and Build id associated with the plans that have no associated definition.

SELECT B.FULL_KEY, B.BUILD_ID FROM BUILD B
   WHERE BUILD_TYPE = 'CHAIN'
      AND NOT EXISTS (SELECT BD.BUILD_DEFINITION_ID FROM BUILD_DEFINITION BD
                         WHERE BD.BUILD_ID = B.BUILD_ID);


Workaround

We will need to insert default build definitions and associate them with the Builds that do not currently have an associate build definition.

  • Stop Bamboo
  • Find the highest BUILD_DEFINITION_ID currently used.

The BUILD_DEFINITION_ID that we use as a key for the BUILD_DEFINITION needs to be unique.

The following SQL will return the largest BUILD_DEFINITION_ID that is currently used.

SELECT MAX(BUILD_DEFINITION_ID) FROM BUILD_DEFINITION;
  • Determine the BUILD_ID of Build plans that do not currently have a definition. 

The following SQL will also list the plan key so that you can readily correct the build details if necessary once upgraded.

SELECT B.FULL_KEY, B.BUILD_ID FROM BUILD B
   WHERE BUILD_TYPE = 'CHAIN'
      AND NOT EXISTS (SELECT BD.BUILD_DEFINITION_ID FROM BUILD_DEFINITION BD
                         WHERE BD.BUILD_ID = B.BUILD_ID);
  • For each of these Builds insert a dummy build definition.

For each of the Builds identified in the previous SQL we will need to insert a default build definition. We will need to insert each entry using the below SQL with the appropriate BUILD_DEFINITION_IDXXX and BUILD_IDXXX. Substitute BUILD_DEFINITION_IDXXX with a unique id. We can use the largest BUILD_DEFINITION_ID returned from the previous SQL and add 1 for each new entry. Substitute BUILD_IDXXX with the BUILD_ID from the previous SQL..

INSERT INTO BUILD_DEFINITION (BUILD_DEFINITION_ID, BUILD_DEFINITION_TYPE, CREATED_DATE, UPDATED_DATE, XML_DEFINITION_DATA, BUILD_ID) VALUES (BUILD_DEFINITION_IDXXX, 'BUILD', null, null, '<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configuration xml:space="preserve">
  <isMergedConfiguration>false</isMergedConfiguration>
  <cleanWorkingDirectory>false</cleanWorkingDirectory>
  <repositoryDefiningWorkingDirectory>0</repositoryDefiningWorkingDirectory>
  <buildStrategies>
    <defined>true</defined>
  </buildStrategies>
  <triggers>
    <defined>true</defined>
  </triggers>
  <branches>
    <branchCreationEnabled>false</branchCreationEnabled>
    <branchRemovalCleanUpEnabled>false</branchRemovalCleanUpEnabled>
    <inactiveBranchCleanupEnabled>false</inactiveBranchCleanupEnabled>
    <matchingPattern>.*</matchingPattern>
    <removalCleanupPeriodInDays>7</removalCleanupPeriodInDays>
    <inactivityInDays>30</inactivityInDays>
    <defaultNotificationStrategy>notifyCommitters</defaultNotificationStrategy>
    <issueLinking>true</issueLinking>
    <monitorPullRequests>false</monitorPullRequests>
  </branches>
  <branches>
    <defaultBranchIntegration>
      <enabled>false</enabled>
    </defaultBranchIntegration>
  </branches>
  <branchIntegration>
    <enabled>false</enabled>
  </branchIntegration>
  <branchConfiguration>
    <cleanup>
      <disabled>false</disabled>
    </cleanup>
    <notificationStrategy>notifyCommitters</notificationStrategy>
  </branchConfiguration>
  <custom>
    <dependencies>
      <triggerForBranches>true</triggerForBranches>
      <trigger>
        <remote>
          <strategy>None</strategy>
        </remote>
      </trigger>
    </dependencies>
  </custom>
  <bambooDelimiterParsingDisabled>true</bambooDelimiterParsingDisabled>
</configuration>', BUILD_IDXXX);


Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.

  • Confirm that there are no more builds with no associated build definition.
SELECT B.FULL_KEY, B.BUILD_ID FROM BUILD B
   WHERE BUILD_TYPE = 'CHAIN'
      AND NOT EXISTS (SELECT BD.BUILD_DEFINITION_ID FROM BUILD_DEFINITION BD
                         WHERE BD.BUILD_ID = B.BUILD_ID);


  • Start Bamboo

Bamboo should now start and the upgrade proceed past Task 5914.

Resolution

The workaround will allow the upgrade to proceed past Task 5914. The Build plans that did not have an associated build definition should be examined and changed or deleted as desired.

Last modified on Oct 10, 2018

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.