Deployment Terminated

Hi,

We are packaging up migrations and checking them into source control using ReadyRoll. When we attempt to deploy the package the Deploy.ps1 powershell script is executed and the sqlcmd.exe line is generated correctly and is outputted to the log. The deployment process is then terminated as a result of an error. If we run the powershell script manually from the server then the process works fine and the changes are deployed to the database. We’ve tried running the tentacle under the same domain user account as when we’re executing the script successfully manually and also tried passing in the admin credentials for sql server but the error still occurs either way.

I’ve included the error log below. Thanks for your help.

2013-05-14 10:52:33 INFO [Deploy Script] Starting ‘neutrino.testing’ Database Deployment to 'SQLSERVER\SQL2012’
2013-05-14 10:52:33 INFO [Deploy Script] Using SQL Server Authentication
2013-05-14 10:52:33 INFO [Deploy Script] sqlcmd.exe -b -S “SQLSERVER\SQL2012” -i “Migrations.Database_Package.sql” -v DatabaseName="web.testing"
2013-05-14 10:52:33 ERROR Octopus.Shared.Integration.Scripting.ScriptFailureException: Script ‘E:\WEB\Octopus\Applications\Testing\Web\7.0.13134.3_1\bin\Deploy.ps1’ returned non-zero exit code: 1. Deployment terminated.
at Octopus.Shared.Conventions.Implementations.ScriptConvention.RunScript(String scriptName, IConventionContext context) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Conventions\Implementations\ScriptConvention.cs:line 25
at Octopus.Shared.Conventions.Implementations.DeployScriptConvention.Install(IConventionContext context) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Conventions\Implementations\DeployScriptConvention.cs:line 20
at Octopus.Shared.Conventions.ConventionProcessor.Run[TConvention](IConventionContext context, Action2 conventionCallback) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Conventions\ConventionProcessor.cs:line 75 at Octopus.Shared.Conventions.ConventionProcessor.RunConventions(IConventionContext context) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Conventions\ConventionProcessor.cs:line 29 2013-05-14 10:52:33 ERROR Running rollback conventions... 2013-05-14 10:52:33 DEBUG [DeployFailed Script] Script: E:\WEB\Octopus\Applications\Testing\Web\7.0.13134.3_1\bin\DeployFailed.ps1 2013-05-14 10:52:34 INFO [DeployFailed Script] Deployment to 'SQLSERVER\SQL2012' failed. Any open transactions have been rolled-back. 2013-05-14 10:52:34 DEBUG Storing a record of the deployment. 2013-05-14 10:52:34 ERROR Octopus.Shared.Integration.Scripting.ScriptFailureException: Script 'E:\WEB\Octopus\Applications\Testing\Web\7.0.13134.3_1\bin\Deploy.ps1' returned non-zero exit code: 1. Deployment terminated. at Octopus.Shared.Conventions.Implementations.ScriptConvention.RunScript(String scriptName, IConventionContext context) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Conventions\Implementations\ScriptConvention.cs:line 25 at Octopus.Shared.Conventions.Implementations.DeployScriptConvention.Install(IConventionContext context) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Conventions\Implementations\DeployScriptConvention.cs:line 20 at Octopus.Shared.Conventions.ConventionProcessor.Run[TConvention](IConventionContext context, Action2 conventionCallback) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Conventions\ConventionProcessor.cs:line 75
at Octopus.Shared.Conventions.ConventionProcessor.RunConventions(IConventionContext context) in c:\w\e6923628be6eaf72\source\Octopus.Shared\Conventions\ConventionProcessor.cs:line 46
at Octopus.Tentacle.Deployment.DeploymentController.Execute(StoredPackage package, VariableDictionary variables, IActivityLog log) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Deployment\DeploymentController.cs:line 50
at Octopus.Tentacle.Services.Jobs.JobQueue.RunDeploymentsOnBackgroundThread(Object ignored) in c:\w\e6923628be6eaf72\source\Octopus.Tentacle\Services\Jobs\JobQueue.cs:line 82

Hi Alex,

Can you try running your deployment script using Tentacle manually (see this link for instructions) to see if you get the same result?

Paul

Hi Paul,

Thanks for the quick response.

I ran the script using Tentacle.exe and it worked completely fine, with the migration being applied correctly to the database. However, the error is still being generated when Octopus attempts the deployment itself.

Just as an update on the issue we’re having:

The migrations are contained within a separate project alongside the web application. When checked in, changes go through the TFS contininuous integration process. During this process, the nuget packages for the web application and database migrations are generated.

The output of the database project is also included in the web application package and when this is deployed, Octopus encounters an error when it gets to the Deploy powershell script.

If we create a separate release and just point it at the database package then everything works fine and the migrations are applied without any errors.

We need to either resolve the error which is generated when the script is executed from within the web application package or somehow exclude the scripts from that package and use the database package for deployment of migrations.

As a final update, we resolved the issue by modifying the build process to separate the binaries by project, rather than putting them all together. This meant that the Deploy powershell script was only in the database package and we could then deploy that as an additional step.

Add /p:GenerateProjectSpecificOutputFolder=true to the MSBuild arguments to separate the binaries by project.

Hi Alex,

Thanks for the update and I’m glad you got it sorted!

Paul