I have a working project that sets the SQL Servers to #{DataSource} with a variable (whose value I cannot find). I have a new project with a Red Gate Database Deployment step in which I entered the connection string (hard-coded) as a variable for DataSource. The deployment refuses to work. I get this error:
Is Octopus supposed to construct the connection string automatically?
The working
Parsing connection string: 10.200.179.50\SQL2012
Error 17:16:32
New-Object : Exception calling “.ctor” with “1” argument(s): "Format of the
Error 17:16:32
initialization string does not conform to specification starting at index 0."
Error 17:16:32
At C:\Octopus\Applications.SQ-ILBUILD02-E3DDA1FE\Octopus.Tentacle\2.6.5.1010\S
Error 17:16:32
cripts\Octopus.Features.RedGateDatabase_BeforePostDeploy.ps1:48 char:13
Error 17:16:32
Thanks for getting in touch. I’ve notified the RedGate team about your query, and one of their support team members will drop by this thread to give us a hand.
I managed to solve the problem. I found that at the top of the Red Gate Database (beta) project step type dialog there are ways to include various shared libraries of variables. I was missing a couple of them. Now works pretty well.
I do get this warning, but do not understand how to deal with it:
The script file “RedGate\PreDeploy.ps1” contained within the package will not be executed because it is contained within a child folder. As of Octopus Deploy 2.4, scripts in sub folders will not be executed.
Glad to see that you have sorted the initial problem. As for the new warning I believe it comes from a difference in how Octopus and DM handle pre and post deploy scripts. To get this script to run you need to change how the package is created.
When creating the package you will be putting the file PreDeploy.ps1 into the RedGate folder, for Octopus it needs to be put into the root. Other options are available to run this script, see the Octopus docs for more info.
What happens will depend on what is in the script, if it is one created by RedGate then it is safe to delete as it was only doing DM specific checks that are not needed in Octopus. So you should be safe deleting it.