Upgrade error from 2018.11 to 2019.1.0


(queil) #1

Hi support,

There is an issue during upgrade. I guess it might be related to the fact that those artifacts belong to a disabled project. Deleting that particular release and artifact just caused another error with a different artifact.

Executing .NET Database Server script 'Octopus.Core.UpgradeScripts.Script0134MigrateArtifactRelatedDocumentsToColumn.cs'
Checking whether journal table exists..
Converting artifacts to a new format to increase the performance of your Octopus server.
Processing 57 artifacts...
Processed 0 of 57
Error: The upgrade script is unable to process the artifact with id Artifacts-4530, the upgrade has been halted.
Error: Please re-install the version of Octopus Deploy that you are upgrading from and get in touch with support@octopus.com providing the following information:
Error: Unable to migrate artifact with id Artifacts-4530. Expected to find one ServerTask in RelatedDocumentIds. RelatedDocumentIds are |Releases-5188| 
Error occured when executing scripts, transaction will be rolled back
Error: Upgrade failed due to an unexpected exception:
Error: System.InvalidOperationException: Sequence contains no matching element
Error:    at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
Error:    at Octopus.Core.UpgradeScripts.Script0134MigrateArtifactRelatedDocumentsToColumn.GetServerTaskIdForArtifacts(IEnumerable`1 artifacts, IUpgradeLog log, Int32 total)
Error:    at Octopus.Core.UpgradeScripts.Script0134MigrateArtifactRelatedDocumentsToColumn.Execute(IDbCommandExecutor commandExecutor, IUpgradeLog log)
Error:    at Octopus.Core.Initialization.DbCommandUpgradeScriptResolver.Execute(Func`1 commandFactory, IUpgradeLog log)
Error:    at Octopus.Core.Initialization.DatabaseUpgrader.OctopusUpgradeScriptExecutor.<>c__DisplayClass6_0.<ExecuteDbCommandUpgradeScript>b__0(Func`1 commandFactory)
Error:    at DbUp.Engine.Transactions.SingleTrasactionStrategy.Execute(Action`1 action)
Error:    at Octopus.Core.Initialization.DatabaseUpgrader.OctopusUpgradeScriptExecutor.ExecuteDbCommandUpgradeScript(IConnectionManager connectionManager, IJournal journal, IUpgradeLog log, IDbCommandUpgradeScript upgradeScript)
Error:    at Octopus.Core.Initialization.DatabaseUpgrader.OctopusUpgradeScriptExecutor.Execute(SqlScript script, IDictionary`2 variables)
Error:    at DbUp.Engine.UpgradeEngine.PerformUpgrade()
Error: We encountered an error during the schema upgrade. The schema upgrade was stopped and rolled back. Don't worry, this means we haven't made any changes to your data, and you should be able to get back up and running quickly.
Error: Here is the summary of the problems we encountered:
Error: -----------------------------------------
Error: Sequence contains no matching element
Error: System.InvalidOperationException
Error:    at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
Error:    at Octopus.Core.UpgradeScripts.Script0134MigrateArtifactRelatedDocumentsToColumn.GetServerTaskIdForArtifacts(IEnumerable`1 artifacts, IUpgradeLog log, Int32 total)
Error:    at Octopus.Core.UpgradeScripts.Script0134MigrateArtifactRelatedDocumentsToColumn.Execute(IDbCommandExecutor commandExecutor, IUpgradeLog log)
Error:    at Octopus.Core.Initialization.DbCommandUpgradeScriptResolver.Execute(Func`1 commandFactory, IUpgradeLog log)
Error:    at Octopus.Core.Initialization.DatabaseUpgrader.OctopusUpgradeScriptExecutor.<>c__DisplayClass6_0.<ExecuteDbCommandUpgradeScript>b__0(Func`1 commandFactory)
Error:    at DbUp.Engine.Transactions.SingleTrasactionStrategy.Execute(Action`1 action)
Error:    at Octopus.Core.Initialization.DatabaseUpgrader.OctopusUpgradeScriptExecutor.ExecuteDbCommandUpgradeScript(IConnectionManager connectionManager, IJournal journal, IUpgradeLog log, IDbCommandUpgradeScript upgradeScript)
Error:    at Octopus.Core.Initialization.DatabaseUpgrader.OctopusUpgradeScriptExecutor.Execute(SqlScript script, IDictionary`2 variables)
Error:    at DbUp.Engine.UpgradeEngine.PerformUpgrade()
Error: -----------------------------------------
Error: Beginning transaction
Error: Checking whether journal table exists..
Error: Executing .NET Database Server script 'Octopus.Core.UpgradeScripts.Script0134MigrateArtifactRelatedDocumentsToColumn.cs'
Error: Checking whether journal table exists..
Error: Converting artifacts to a new format to increase the performance of your Octopus server.
Error: Processing 57 artifacts...
Error: Processed 0 of 57
Error: The upgrade script is unable to process the artifact with id Artifacts-4530, the upgrade has been halted.
Error: Please re-install the version of Octopus Deploy that you are upgrading from and get in touch with support@octopus.com providing the following information:
Error: Unable to migrate artifact with id Artifacts-4530. Expected to find one ServerTask in RelatedDocumentIds. RelatedDocumentIds are |Releases-5188| 
Error: Error occured when executing scripts, transaction will be rolled back
Error: Upgrade failed due to an unexpected exception:
Error: System.InvalidOperationException: Sequence contains no matching element
Error:    at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
Error:    at Octopus.Core.UpgradeScripts.Script0134MigrateArtifactRelatedDocumentsToColumn.GetServerTaskIdForArtifacts(IEnumerable`1 artifacts, IUpgradeLog log, Int32 total)
Error:    at Octopus.Core.UpgradeScripts.Script0134MigrateArtifactRelatedDocumentsToColumn.Execute(IDbCommandExecutor commandExecutor, IUpgradeLog log)
Error:    at Octopus.Core.Initialization.DbCommandUpgradeScriptResolver.Execute(Func`1 commandFactory, IUpgradeLog log)
Error:    at Octopus.Core.Initialization.DatabaseUpgrader.OctopusUpgradeScriptExecutor.<>c__DisplayClass6_0.<ExecuteDbCommandUpgradeScript>b__0(Func`1 commandFactory)
Error:    at DbUp.Engine.Transactions.SingleTrasactionStrategy.Execute(Action`1 action)
Error:    at Octopus.Core.Initialization.DatabaseUpgrader.OctopusUpgradeScriptExecutor.ExecuteDbCommandUpgradeScript(IConnectionManager connectionManager, IJournal journal, IUpgradeLog log, IDbCommandUpgradeScript upgradeScript)
Error:    at Octopus.Core.Initialization.DatabaseUpgrader.OctopusUpgradeScriptExecutor.Execute(SqlScript script, IDictionary`2 variables)
Error:    at DbUp.Engine.UpgradeEngine.PerformUpgrade()

Thanks,
queil


(Shane Gill) #5

Hi Quiel,

Thanks for getting in touch.

So that we can better understand why your artifacts are missing ServerTasks could you run the following query on your Octopus database and send the results to support@octopus.com?

SELECT * FROM [dbo].[Artifact]

You can see all of the artifacts that are blocking the upgrade by running the following query:

SELECT *
FROM [dbo].[Artifact]
WHERE [RelatedDocumentIds] NOT LIKE '%ServerTasks%'

If you are happy that you don’t need those artifacts you can delete them and proceed with the upgrade:

DELETE
FROM [dbo].[Artifact]
WHERE [RelatedDocumentIds] NOT LIKE '%ServerTasks%'

I hope this helps, please let me know if you have any questions or concerns.

Cheers,
Shane


(queil) #6

Hi Shane,

So I run the queries. The offending attachments we added via Octopus Client (from an F# build script) specifying only the following ids e.g. |Releases-16281|Projects-382|Environments-43|. Does it mean we need to start also adding ServerTask? If yes, where should it come from? We do not want to delete those artifacts as they serve for auditing purposes. How can we resolve the issue otherwise?

Thanks,
queil


(Shane Gill) #7

Hi Quiel,

Thanks for explaining what you are doing. So from your build script are you creating a release and then associating the artifact with that release? Are you also creating a deployment? Would it make sense for the artifact to be associated with a deployment or is it really a release artifact?

I didn’t anticipate release level artifacts but it does make sense when I think about it - you could attach something like release notes from the build as an artifact.

Look forward to learning more about how you are using artifacts.

Cheers,
Shane


(queil) #8

Hi Shane,

We create a release only. The release has just one deployment (single environment) triggered manually. The artifact (it’s a code source file) gets attached to an email once the deployment is finished. I hope that helps.

Thanks,
queil


(bruno.rubin) #9

Hi Support,

We’re having a very similar issue when trying to update from 2018.9.6 to 2019.1.2. Here’s the log file:

2019-02-03 22:40:29.7040   6304      8 ERROR  The upgrade script is unable to process the artifact with id Artifacts-9681, the upgrade has been halted.
2019-02-03 22:40:29.7040   6304      8 ERROR  Please re-install the version of Octopus Deploy that you are upgrading from and get in touch with support@octopus.com providing the following information:
2019-02-03 22:40:29.7040   6304      8 ERROR  Unable to migrate artifact with id Artifacts-9681. Expected to find one ServerTask in RelatedDocumentIds. RelatedDocumentIds are ||Releases-3504| 
2019-02-03 22:40:29.7040   6304      8  WARN  Error occured when executing scripts, transaction will be rolled back
2019-02-03 22:40:29.9696   6304      8 ERROR  Upgrade failed due to an unexpected exception:
System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   at Octopus.Core.UpgradeScripts.Script0134MigrateArtifactRelatedDocumentsToColumn.GetServerTaskIdForArtifacts(IEnumerable`1 artifacts, IUpgradeLog log, Int32 total)
   at Octopus.Core.UpgradeScripts.Script0134MigrateArtifactRelatedDocumentsToColumn.Execute(IDbCommandExecutor commandExecutor, IUpgradeLog log)
   at Octopus.Core.Initialization.DbCommandUpgradeScriptResolver.Execute(Func`1 commandFactory, IUpgradeLog log)
   at Octopus.Core.Initialization.DatabaseUpgrader.OctopusUpgradeScriptExecutor.<>c__DisplayClass6_0.<ExecuteDbCommandUpgradeScript>b__0(Func`1 commandFactory)
   at DbUp.Engine.Transactions.SingleTrasactionStrategy.Execute(Action`1 action)
   at Octopus.Core.Initialization.DatabaseUpgrader.OctopusUpgradeScriptExecutor.ExecuteDbCommandUpgradeScript(IConnectionManager connectionManager, IJournal journal, IUpgradeLog log, IDbCommandUpgradeScript upgradeScript)
   at Octopus.Core.Initialization.DatabaseUpgrader.OctopusUpgradeScriptExecutor.Execute(SqlScript script, IDictionary`2 variables)
   at DbUp.Engine.UpgradeEngine.PerformUpgrade()

Haven’t performed any changes to the database and re-installed the version we were upgrading from to be able to start the Octopus Server again.

Cheers,
Bruno.


(Shane Gill) #10

Hi Bruno,

Do you have a similar process in place to Queil where you are creating artifacts via the API? If so could you help me understand how you are using those artifacts?

Cheers,
Shane


(bruno.rubin) #11

Hi Shane,

we used the SQL queries from the post above and managed to find the broken artifact . After removing it, the upgrade process worked successfully.

Thanks!


(Shane Gill) #12

Hi Queil,

We are trying to decide if we want to support artifacts at the release level. Artifacts are intended to be collected during a deployment but prior to 2019.1 there was not enforcement of that intent, so you’ve arrived at a place we didn’t expect you to go.

Trying to plot the best way forward, would it be possible to use a package that contains the source code file to attach to the e-mail? Do you have a custom script that finds the artifact and sends the e-mail? If that was a possibility I think we could migrate your existing artifacts so they will continue to work with your old deployment process and upgrade successfully to 2019.1.

I’m happy to help any way I can.

Cheers,
Shane


(queil) #13

Hi Shane,

We’ll delete those artifacts. Then we’ll change the process to include the code file in the package, and will add a deployment step that pulls the file out and attaches that to an email.

Thanks,
queil


(system) closed #14

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.