DBUP Error

I just recently upgraded my OD server and tentacles to 2.1. When I attempt to run my deployment, it fails on the DBUP step, which I fired off using a powershell script included in the project. This used to work in 1.6. Here is the output.
@@@
Task ID: ServerTasks-271

Task status: Failed

Task queued: Friday, March 14, 2014 9:57 AM

Task started: Friday, March 14, 2014 9:57 AM

Task duration: 11 seconds

                | Failed: Deploy Home School Registry release 1.0.0.18 to Staging

09:57:51 Verbose | Packages acquired

09:57:53 Verbose | First chance failure detected in: Running step “Database” on “MERLIN3”…

                |   One or more items in the current operation failed.

09:57:53 Verbose | An operation in “Database” failed

                |   Operation: Running step "Database" on "MERLIN3" failed with error: One or more items in the current operation failed.

09:57:53 Verbose | Step “Website” runs only when all previous steps succeeded; skipping

09:57:53 Verbose | Database completed

09:57:53 Fatal | A step failed

09:57:53 Verbose | The task failed

                | 

                |   Success: Acquire packages

09:57:42 Info | Downloading packages

09:57:42 Info | Making a list of packages to download

09:57:42 Verbose | The following packages will be downloaded by the Octopus Server:

09:57:42 Verbose | - HomeSchoolRegistry.Database 1.0.0.18 (feed: TeamCity)

09:57:42 Verbose | - HomeSchoolRegistry 1.0.0.18 (feed: TeamCity)

09:57:42 Verbose | The following packages will be downloaded directly by Tentacles:

09:57:51 Info | All packages have been downloaded

                |   

                |     Success: Download package HomeSchoolRegistry.Database 1.0.0.18 from NuGet feed: TeamCity

09:57:42 Info | Downloading NuGet package HomeSchoolRegistry.Database 1.0.0.18 from feed: ‘http://10.214.50.131:81/httpAuth/app/nuget/v1/FeedService.svc/

09:57:42 Verbose | Downloaded packages will be stored in: C:\Octopus\PackageCache\feeds-1

09:57:42 Verbose | Finding package (attempt 1 of 5)

09:57:43 Verbose | Found package HomeSchoolRegistry.Database version 1.0.0.18

09:57:43 Verbose | Downloading to: C:\Octopus\PackageCache\feeds-1\HomeSchoolRegistry.Database.1.0.0.18_D568AE63FF8807419A417C6E81EAE5AB.nupkg

09:57:43 Verbose | SHA1 hash of package is: 4ecb0f1edaacc7dbbebe208be1c2fcf3f0cc4d2a

09:57:43 Verbose | Determining machines that need the package

                |     

                |       Success: Upload package to SQ-MERLIN3-9E370098

09:57:43 Verbose | Starting Upload package to SQ-MERLIN3-9E370098

09:57:43 Info | Uploading HomeSchoolRegistry.Database.1.0.0.18 (0.03 MB) to SQ-MERLIN3-9E370098

09:57:43 Verbose | Uploading package HomeSchoolRegistry.Database 1.0.0.18 to tentacle SQ-MERLIN3-9E370098

09:57:43 Verbose | Requesting upload…

09:57:49 Verbose | File C:\Octopus\PackageCache\feeds-1\HomeSchoolRegistry.Database.1.0.0.18_D568AE63FF8807419A417C6E81EAE5AB.nupkg with hash 4ecb0f1edaacc7dbbebe208be1c2fcf3f0cc4d2a successfully uploaded to SQ-MERLIN3-9E370098

09:57:49 Verbose | Storing the uploaded file in the package cache

09:57:49 Verbose | Storing C:\Octopus\Files\HomeSchoolRegistry.Database.1.0.0.18_D568AE63FF8807419A417C6E81EAE5AB.nupkg-9aa578e7-31d5-4d32-bfb8-ce1877a51821 as package Octopus.Platform.Deployment.Packages.PackageMetadata

09:57:49 Info | Package HomeSchoolRegistry.Database 1.0.0.18 successfully uploaded to tentacle SQ-MERLIN3-9E370098

                |       

                |     Success: Download package HomeSchoolRegistry 1.0.0.18 from NuGet feed: TeamCity

09:57:42 Info | Downloading NuGet package HomeSchoolRegistry 1.0.0.18 from feed: ‘http://10.214.50.131:81/httpAuth/app/nuget/v1/FeedService.svc/

09:57:43 Verbose | Downloaded packages will be stored in: C:\Octopus\PackageCache\feeds-1

09:57:43 Verbose | Finding package (attempt 1 of 5)

09:57:43 Verbose | Found package HomeSchoolRegistry version 1.0.0.18

09:57:43 Verbose | Downloading to: C:\Octopus\PackageCache\feeds-1\HomeSchoolRegistry.1.0.0.18_82947EC02B6E32479504771C3B3835B3.nupkg

09:57:43 Verbose | SHA1 hash of package is: 9e2c015f0574604568a85212622681f34ba63e66

09:57:43 Verbose | Determining machines that need the package

                |     

                |       Success: Upload package to SQ-MERLIN3-9E370098

09:57:43 Verbose | Starting Upload package to SQ-MERLIN3-9E370098

09:57:43 Info | Uploading HomeSchoolRegistry.1.0.0.18 (5.18 MB) to SQ-MERLIN3-9E370098

09:57:43 Verbose | Uploading package HomeSchoolRegistry 1.0.0.18 to tentacle SQ-MERLIN3-9E370098

09:57:43 Verbose | Requesting upload…

09:57:51 Verbose | File C:\Octopus\PackageCache\feeds-1\HomeSchoolRegistry.1.0.0.18_82947EC02B6E32479504771C3B3835B3.nupkg with hash 9e2c015f0574604568a85212622681f34ba63e66 successfully uploaded to SQ-MERLIN3-9E370098

09:57:51 Verbose | Storing the uploaded file in the package cache

09:57:51 Verbose | Storing C:\Octopus\Files\HomeSchoolRegistry.1.0.0.18_82947EC02B6E32479504771C3B3835B3.nupkg-6da3d4df-7dd3-4139-8eb6-c0ab4aa51dba as package Octopus.Platform.Deployment.Packages.PackageMetadata

09:57:51 Info | Package HomeSchoolRegistry 1.0.0.18 successfully uploaded to tentacle SQ-MERLIN3-9E370098

                |       

                |   Failed: Step 1: Database

09:57:51 Info | Executing step: Database

09:57:53 Fatal | The step failed

                |   

                |     Failed: MERLIN3

09:57:51 Verbose | Starting Running step “Database” on “MERLIN3”

09:57:52 Info | Running “Database” on “MERLIN3”

09:57:53 Verbose | Guided Failure is not in use for this deployment; failing.

                |     

                |       Failed: Deploy HomeSchoolRegistry.Database on MERLIN3

09:57:52 Info | Beginning deployment…

09:57:52 Verbose | Begin deployment of package: HomeSchoolRegistry.Database.1.0.0.18

                |         Package file path:           C:\Octopus\Applications\.Tentacle\Packages\HomeSchoolRegistry.Database.1.0.0.18_68C7261D762BDA4AA90FFD8DC6E9ADB4.nupkg

                |         Package file hash:           4ecb0f1edaacc7dbbebe208be1c2fcf3f0cc4d2a

                |         Tentacle Agent information:

                |         - Machine name:       MERLIN3

                |         - Is 64-bit:          True

                |         - Service user name:  SYSTEM

                |         - CLR version:        4.0.30319.18052

                |         - Current directory:  C:\Windows\system32

                |         - OS version:         Microsoft Windows NT 6.0.6002 Service Pack 2

                |         - Tentacle version:   2.1.3.1223

09:57:52 Verbose | Package will be extracted to: C:\Octopus\Applications\Staging

09:57:52 Verbose | Looking for appSettings and connectionStrings in any .config files

09:57:52 Verbose | Scanning configuration file: C:\Octopus\Applications\Staging\HomeSchoolRegistry.Database\1.0.0.18_2\HomeSchoolRegistry.Database.exe.config

09:57:53 Error | Error running conventions; running rollback conventions…

09:57:53 Verbose | Storing a record of the deployment.

09:57:53 Verbose | Failed receiving Octopus.Tentacle.Orchestration.Deploy.Mutex.AcquiredEvent

                |         A convention could not be successfully applied.

                |         Octopus.Platform.Deployment.ControlledFailureException: A convention could not be successfully applied. ---> Octopus.Tentacle.Deployment.Integration.Scripting.ScriptFailureException: Script 'C:\Windows\system32\#{OctopusPackageDirectoryPath}\Deploy.ps1' returned non-zero exit code: 5888. Deployment terminated.

                |         at Octopus.Tentacle.Deployment.Conventions.Implementations.ScriptConvention.<>c__DisplayClass1.<RunScripts>b__0(IConventionContext cc) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Deployment\Conventions\Implementations\ScriptConvention.cs:line 66

                |         at Octopus.Tentacle.Deployment.Conventions.ConventionContextExtensions.RunChildOperation(IConventionContext context, String friendlyName, Action`1 operation) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Deployment\Conventions\ConventionContextExtensions.cs:line 15

                |         --- End of inner exception stack trace ---

                |         at Octopus.Tentacle.Deployment.Conventions.ConventionContextExtensions.RunChildOperation(IConventionContext context, String friendlyName, Action`1 operation) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Deployment\Conventions\ConventionContextExtensions.cs:line 28

                |         at Octopus.Tentacle.Deployment.Conventions.Implementations.ScriptConvention.RunScripts(IEnumerable`1 scriptFiles, IConventionContext context) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Deployment\Conventions\Implementations\ScriptConvention.cs:line 36

                |         at Octopus.Tentacle.Deployment.Conventions.Implementations.DeployScriptConvention.Install(IConventionContext context) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Deployment\Conventions\Implementations\DeployScriptConvention.cs:line 15

                |         at Octopus.Tentacle.Deployment.Conventions.ConventionProcessor.<RunInstallConventions>b__0(IInstallationConvention c, IConventionContext ctx) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Deployment\Conventions\ConventionProcessor.cs:line 60

                |         at Octopus.Tentacle.Deployment.Conventions.ConventionProcessor.Run[TConvention](IConventionContext context, Action`2 conventionCallback) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Deployment\Conventions\ConventionProcessor.cs:line 84

                |         at Octopus.Tentacle.Deployment.Conventions.ConventionProcessor.RunConventions(IConventionContext context) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Deployment\Conventions\ConventionProcessor.cs:line 51

                |         at Octopus.Tentacle.Deployment.DeploymentController.Execute(StoredPackage package, VariableDictionary variables, ILog log, Action`1 storeCreatedArtifact) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Deployment\DeploymentController.cs:line 55

                |         at Octopus.Tentacle.Orchestration.Deploy.Package.TentaclePackageDeployment.Receive(AcquiredEvent message) in c:\TeamCity\buildAgent\work\1116bd9da9e239fd\source\Octopus.Tentacle\Orchestration\Deploy\Package\TentaclePackageDeployment.cs:line 96

                |         at Pipefish.Actor.OnReceivingTyped[TBody](Message message) in c:\TeamCity\buildAgent\work\cf0b1f41263b24b9\source\Pipefish\Actor.cs:line 113

09:57:53 Fatal | A convention could not be successfully applied.

                |       

                |         Success: Updating HomeSchoolRegistry.Database.exe.config

09:57:52 Info | Updating appSettings and connectionStrings in: C:\Octopus\Applications\Staging\HomeSchoolRegistry.Database\1.0.0.18_2\HomeSchoolRegistry.Database.exe.config

09:57:52 Info | Setting //[local-name()=‘connectionStrings’]/[local-name()=‘add’][@name=‘HomeSchoolRegistryConnectionString’] to ‘Data Source=192.168.2.40\IDOESQLSTAGE,1450;Initial Catalog=HomeSchoolRegistry;Persist Security Info=True;User ID=homeschool;Password=homeschool’

                |         

                |         Success: Copy files to C:\Windows\system32\#{OctopusPackageDirectoryPath}

09:57:52 Info | Copying package contents to ‘C:\Windows\system32#{OctopusPackageDirectoryPath}’

                |         

                |         Failed: Deploy.ps1

09:57:52 Verbose | Script: C:\Windows\system32#{OctopusPackageDirectoryPath}\Deploy.ps1

09:57:53 Fatal | Script ‘C:\Windows\system32#{OctopusPackageDirectoryPath}\Deploy.ps1’ returned non-zero exit code: 5888. Deployment terminated.

                |         

                |   Skipped: Step 2: Website

@@@

Any suggestions or reasons why this would not be working???

Hi,

Going by the error message, DbUp is not rendering any output, but it is returning an exit code of 5888, which Octopus assumes is a failure.

Could you share what your DbUp program.cs file looks like? What happens if you remote to the machine and run DbUp manually?

My guess would be that your Tentacle Windows Service is running under a user account that doesn’t have permission to query the SQL database.

Paul

Hi Paul,

I managed to track down the issue. The server that I am running the command on, does not allow power shell scripts to be executed. Which is funny, because they worked on this server, before upgrading everything to the latest version. I am working with my server admin to get this issue resolved.

Thanks.

Hi Paul,

My server admin has allowed the execution of powershell scripts on the servers with the tentacle installed. I can manually run the script and it executes as expected. I then changed the tentacle service to run under my own account and I am still getting the same error that the powershell script could not be executed. Were there any security considerations when upgrading the tentacles?

Here is the output of the raw log for the error that I am getting.

                    |         Warning: Deploy.ps1

14:22:11   Error    |           The term '#{OctopusPackageDirectoryPath}\Bootstrap.3dd5dbe2-931a-487a-abe5-464e

14:22:11   Error    |           df97c8dc.ps1' is not recognized as the name of a cmdlet, function, script file,

14:22:11   Error    |           or operable program. Check the spelling of the name, or if a path was included

14:22:11   Error    |           , verify that the path is correct and try again.

14:22:11   Error    |           At line:1 char:5

14:22:11   Error    |           + . {. <<<<  '#{OctopusPackageDirectoryPath}\Bootstrap.3dd5dbe2-931a-487a-abe5-

14:22:11   Error    |           464edf97c8dc.ps1'; if ((test-path variable:global:lastexitcode)) { exit $LastEx

14:22:11   Error    |           itCode }}

14:22:11   Error    |           + CategoryInfo          : ObjectNotFound: (#{OctopusPackag...64edf97c8dc.p

14:22:11   Error    |           s1:String) [], CommandNotFoundException

14:22:11   Error    |           + FullyQualifiedErrorId : CommandNotFoundException

14:22:11   Warning  |           The script returned an exit code of 0, but output was written to the error output stream. Please investigate any errors in the script output above.

Hi - is there a variable defined called Octopus.Action.Package.CustomInstallationDirectory in your project? (Project > Variables). We add this automatically to upgraded projects, but it depends on another variable that seems like it has subseqently been removed from your project. Any info on your variables will probably help with solving this one.

Many thanks,
Nick

Thanks for the response.

I actually removed that variable from the list, as we use the default paths for everything except where to deploy the actual code. Once I removed that variable and reimported them for the release, everything ran like it should. I love your company’s product it will save me so much time and our department so much money not having to do manual code releases.

Thanks for the update, glad you got this working and thanks for the kind words!