DM Variables and Deploy.ps1
fredendrix
Posts: 32
Hi!
Deployment Manager is a great tool and i'm almost done with all our CI setup. But a thing remains not clear, about variables in DM. Here's the scenario:
Ou changes are done directly on the Developpment database, that is under SVN using SQL Source Control.
Then, Teamcity grab it and the RedGate's command line utility (sqlCI.exe) package the new DB state and publish it on our nuGet server. I do NOT specify databaseServer and databaseName, since I would like to use DM Variables to specify those values, depending on wich environment I'd like to deploy ("Test" and so on...).
So the DB nuGet package contains the Powerscript file (Deploy.ps1), with $databaseServer and $databaseName variables in it. But what if I would like to specify those value in DM variables? I tried:
databaseServer
$databaseServer
$Deployment ManagerParameters["databaseServer"]
$Deployment ManagerParameters["$databaseServer"]
But neither seems to be "catched" by Powershell host while deploying, since I always get :
"ERROR: Define the variable "databaseServer""
Any help would be greately appreciated.
Thanks!
Deployment Manager is a great tool and i'm almost done with all our CI setup. But a thing remains not clear, about variables in DM. Here's the scenario:
Ou changes are done directly on the Developpment database, that is under SVN using SQL Source Control.
Then, Teamcity grab it and the RedGate's command line utility (sqlCI.exe) package the new DB state and publish it on our nuGet server. I do NOT specify databaseServer and databaseName, since I would like to use DM Variables to specify those values, depending on wich environment I'd like to deploy ("Test" and so on...).
So the DB nuGet package contains the Powerscript file (Deploy.ps1), with $databaseServer and $databaseName variables in it. But what if I would like to specify those value in DM variables? I tried:
databaseServer
$databaseServer
$Deployment ManagerParameters["databaseServer"]
$Deployment ManagerParameters["$databaseServer"]
But neither seems to be "catched" by Powershell host while deploying, since I always get :
"ERROR: Define the variable "databaseServer""
Any help would be greately appreciated.
Thanks!
Comments
One thing to be aware of with releases that might be affecting you is that they are immutable, so even if you change the variables you must create a new release to pick up the new variable definitions.
If you look at the release you got the error on, you can expand the view variable snapshot link and see what values were used for that release. If you have not had chance to upgrade to the latest version of Deployment Manager you will encounter a bug, which is now fixed where you must click view variable snapshot twice for it to expand.
Deployment Manager looks for the most specific variable first. For example, you can define databaseName to be Development for the Development environment and then define another databaseName variable with the value NonDevelopment. NonDevelopmentwould be used for all environments other than Development.
A member of our Usability team would really like to talk to you, if you would be happy then please email DMSupport@red-gate.com and we can pass on your details.
But now, when I try to package again with sqlCI.exe, the TeamCity runner could not reach the Deployment Manager anymore.
Seems that since i've updated DM server (1.0.12.3), sqlCI.exe returns this error :
System.Net.WebException: Unable to connect to the remote server.
Here's the parameters:
C:\SQLCI\sqlci --scriptsFolder=. --packageId=UnivBase --packageVersion=%build.vcs.number% --generateUpgradeScriptForCurrentlyDeployedVersions --deploymentManagerUrl=http://iisdevsvc:666/ --deploymentManagerApiKey=XXXXXXXXXXXXXX
If I paste the DM URL in web browser from build server, it works (no net error).
Any idea?[/i]
Application information:
Application domain: /LM/W3SVC/1/ROOT-1-130004907569641936
Trust level: Full
Application Virtual Path: /
Application Path: C:\Program Files (x86)\Red Gate\Deployment Manager\Portal\
Machine name: SRVIIS04
Process information:
Process ID: 6016
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE
Exception information:
Exception type: ArgumentNullException
Exception message: Value cannot be null.
Parameter name: httpContext
at System.Web.HttpContextWrapper..ctor(HttpContext httpContext)
at Glimpse.Core.Extensibility.GlimpseTimer.get_TimerMetadata()
at Glimpse.RavenDb.Profiler.StopTrackingStore(Object sender, EventArgs e)
at Raven.Client.Document.DocumentStore.Dispose()
at Autofac.Core.Disposer.Dispose(Boolean disposing)
at Autofac.Util.Disposable.Dispose()
at Autofac.Core.Lifetime.LifetimeScope.Dispose(Boolean disposing)
at Autofac.Util.Disposable.Dispose()
at RedGate.Deploy.Portal.MvcApplication.Application_End()
You can close tickets about sqlCI.exe problems and DM variables (Deploy.ps1).
Thanks!