Uploaded image for project: 'Bamboo Data Center'
  1. Bamboo Data Center
  2. BAM-16098

Invalid object name CREDENTIALS when upgrading Bamboo or creating repositories

      Summary

      Upgrading Bamboo to 5.8.1 with an older database can lead to Bamboo not creating the CREDENTIALS table. However, Bamboo will successfully start but not flag any errors at the UI level.

      Customers who try to create a new Git repository will be presented with the standard new repository dialog box - but no pull down field to specify the Authentication type will be presented as we can't refer to the table in the DB.

      This same issue causes further problems when upgrading to 5.9.x with upgrade task 5907 : Update SSH credentials configuration

      Environment

      • Prominently occurs on Microsoft SQL Server however may also occur on other DBMS due to case-sensitivity configuration.

      Expected Results

      CREDENTIALS Table should have been created by the schema update.

      Actual Results

      Below exception is shown in the atlassian-bamboo.log:

      2017-07-12 13:46:35,908 INFO [13-UpgradeTaskBackgroundThread:pool-28-thread-1] [AbstractUpgradeManager] -------------------------------------------
      2017-07-12 13:46:35,908 INFO [13-UpgradeTaskBackgroundThread:pool-28-thread-1] [AbstractUpgradeManager] 5907 : Update SSH credentials configuration
      2017-07-12 13:46:35,908 INFO [13-UpgradeTaskBackgroundThread:pool-28-thread-1] [AbstractUpgradeManager] -------------------------------------------
      2017-07-12 13:46:35,923 WARN [13-UpgradeTaskBackgroundThread:pool-28-thread-1] [JDBCExceptionReporter] SQL Error: 208, SQLState: S0002
      2017-07-12 13:46:35,923 ERROR [13-UpgradeTaskBackgroundThread:pool-28-thread-1] [JDBCExceptionReporter] Invalid object name 'CREDENTIALS'.
      2017-07-12 13:46:35,923 ERROR [13-UpgradeTaskBackgroundThread:pool-28-thread-1] [AbstractUpgradeManager] org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; SQL [select this_.CREDENTIALS_ID as CREDENTI1_89_0_, this_.PLUGIN_KEY as PLUGIN2_89_0_, this_.NAME as NAME89_0_, this_.XML as XML89_0_ from CREDENTIALS this_]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query
      	at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:642)
      ....
      com.atlassian.bamboo.upgrade.tasks.v5_9.UpgradeTask5907UpdateSshCredentialsConfiguration.doUpgrade(UpgradeTask5907UpdateSshCredentialsConfiguration.java:23)
      	at com.atlassian.bamboo.upgrade.AbstractUpgradeManager.runUpgradeTask(AbstractUpgradeManager.java:206)
      ...
      Caused by: org.hibernate.exception.SQLGrammarException: could not execute query
      	at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:92)
      	at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
      ...
      Caused by: java.sql.SQLException: Invalid object name 'CREDENTIALS'.
      	at net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:372)
      	at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2894)
      ...
      

      Schema update failed to alter the table as it didn't exist:

      2017-07-12 13:46:15,408 INFO [localhost-startStop-1] [UpgradeLauncher] Checking if schema update is required...
      alter table CREDENTIALS add CREDENTIALS_ID numeric(19,0) not null
      2017-07-12 13:46:16,344 ERROR [localhost-startStop-1] [SchemaUpdate] Unsuccessful: alter table CREDENTIALS add CREDENTIALS_ID numeric(19,0) not null
      2017-07-12 13:46:16,344 ERROR [localhost-startStop-1] [SchemaUpdate] Cannot find the object "CREDENTIALS" because it does not exist or you do not have permissions.
      

      Workaround

      1. Stop Bamboo
      2. Backup your Bamboo database and <bamboo-home> for rollback purposes
      3. Create the table manually with the below example SQL (MS SQL):
        CREATE TABLE [dbo].[CREDENTIALS]
        (
            [CREDENTIALS_ID] [numeric](19, 0) NOT NULL,
            [NAME] [nvarchar](255) NULL,
            [XML] [ntext] NULL,
            PRIMARY KEY CLUSTERED (	[CREDENTIALS_ID] ASC) WITH (PAD_INDEX = OFF, 
            STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, 
            ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
        ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
        
      4. Start Bamboo

      Or:

      1. Stop Bamboo
      2. Backup your Bamboo database and <bamboo-home> for rollback purposes
      3. Set the system property using Configuring your system properties to make Bamboo recreate its schema:
        -Datlassian.forceSchemaUpdate=true
      4. Restart Bamboo

          Form Name

            [BAM-16098] Invalid object name CREDENTIALS when upgrading Bamboo or creating repositories

            Atlassian Update - 23 June 2020

            Hi,

            Thank you for raising this issue. We regret to inform you that due to limited demand, we have no plans to implement it in the foreseeable future. In order to set expectations, we're closing this request.

            This is an automated update triggered by low user engagement with this suggestion (number of votes, number of watchers).

            Although we're aware the issue is still important to those of you who were involved in the conversations around it, we want to be clear in managing your expectations. The Bamboo team is focusing on issues that have broad impact and high value, reflected by the number of comments, votes, support cases, and customers interested. Please consult the Atlassian Bugfix Policy for more details.

            We understand how disappointing this decision may be but we want to be fully transparent when communicating with our users.

            Atlassian will continue to watch this issue for further updates, so please feel free to share your thoughts in the comments.

            Thank you,

            Bamboo Team

            Martyna Wojtas (Inactive) added a comment - Atlassian Update - 23 June 2020 Hi, Thank you for raising this issue. We regret to inform you that due to limited demand, we have no plans to implement it in the foreseeable future. In order to set expectations, we're closing this request. This is an automated update triggered by low user engagement with this suggestion (number of votes, number of watchers). Although we're aware the issue is still important to those of you who were involved in the conversations around it, we want to be clear in managing your expectations. The Bamboo team is focusing on issues that have broad impact and high value, reflected by the number of comments, votes, support cases, and customers interested. Please consult the Atlassian Bugfix Policy for more details. We understand how disappointing this decision may be but we want to be fully transparent when communicating with our users. Atlassian will continue to watch this issue for further updates, so please feel free to share your thoughts in the comments. Thank you, Bamboo Team

            I upgraded Bamboo from 5.7 or 5.8 to 5.9 and had the same issue. We did have a CREDENTIALS table though.

            CREDENTIALS CREATE TABLE `CREDENTIALS` (
            `CREDENTIALS_ID` bigint(20) NOT NULL,
            `NAME` varchar(255) COLLATE utf8_bin DEFAULT NULL,
            `XML` longtext COLLATE utf8_bin,
            `PLUGIN_KEY` varchar(255) COLLATE utf8_bin DEFAULT NULL,
            PRIMARY KEY (`CREDENTIALS_ID`)
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin

            I dropped the table, and ran bamboo with -Datlassian.forceSchemaUpdate=true as suggested above, which created the following table:

            CREDENTIALS CREATE TABLE `CREDENTIALS` (
            `CREDENTIALS_ID` bigint(20) NOT NULL,
            `PLUGIN_KEY` varchar(255) COLLATE utf8_bin DEFAULT NULL,
            `NAME` varchar(255) COLLATE utf8_bin DEFAULT NULL,
            `XML` longtext COLLATE utf8_bin,
            PRIMARY KEY (`CREDENTIALS_ID`)
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin

            Everything worked again! I had to re-add my key and fix all my repositories, but after that I was up and running again.

            Bart Verwilst added a comment - I upgraded Bamboo from 5.7 or 5.8 to 5.9 and had the same issue. We did have a CREDENTIALS table though. CREDENTIALS CREATE TABLE `CREDENTIALS` ( `CREDENTIALS_ID` bigint(20) NOT NULL, `NAME` varchar(255) COLLATE utf8_bin DEFAULT NULL, `XML` longtext COLLATE utf8_bin, `PLUGIN_KEY` varchar(255) COLLATE utf8_bin DEFAULT NULL, PRIMARY KEY (`CREDENTIALS_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin I dropped the table, and ran bamboo with -Datlassian.forceSchemaUpdate=true as suggested above, which created the following table: CREDENTIALS CREATE TABLE `CREDENTIALS` ( `CREDENTIALS_ID` bigint(20) NOT NULL, `PLUGIN_KEY` varchar(255) COLLATE utf8_bin DEFAULT NULL, `NAME` varchar(255) COLLATE utf8_bin DEFAULT NULL, `XML` longtext COLLATE utf8_bin, PRIMARY KEY (`CREDENTIALS_ID`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin Everything worked again! I had to re-add my key and fix all my repositories, but after that I was up and running again.

              Unassigned Unassigned
              nhickey Neil Hickey
              Affected customers:
              0 This affects my team
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: