Comments
7 comments
-
Any Octopus variable will automatically be converted into a SqlCmd variable
-
Thank you, Mike. So, I need to create an Octopus variable called ReleaseVersion and set it? Also wondering how I get the version info from the existing variables in Octopus in order to set ReleaseVersion?
Edit: I created an Octoput variable, ReleaseVersion and set its value to:
#{Ocopus.Release.Id}
This just set it to Release.26, even though the name of the release was 1.1.0-build22...looking for another var... -
I am not using Octopus (yet) but I recall seeing this in the doco. https://documentation.red-gate.com/sca3/developing-databases-using-sql-change-automation/generating-deployment-scripts/variables
ReleaseVersion 1.0.0-MyRelease Release number to store against deployed migrations within the [dbo].[__MigrationLog] table. There is no default value for this variable; a warning will be emitted during deployment if it has not been set.
The exception to this is when deploying with Octopus, in which case the value is automatically sourced from the Octopus.Release.Number system variable.
-
Thanks, team. Monday, I saw that part of the docs and assumed it meant that ReleaseVersion would be automatically populated, but that was not happening. I got it working by manually creating a variable in Octopus - ReleaseVersion, and setting it to #{Octopus.Release.Number}
Now, I'm seeing it populated in the dbo.__MigrationLog table (e.g. "1.1.0-build22")
Which came from Bamboo via the Package Version: 1.1.0-build${bamboo.BuildNumber}. Making some progress...
Now, I just want to find the right way to populate the "1.1.0" in Bamboo from the SCA project...probably another post, tho...
-
I am still wondering about why $ReleaseVersion wasn't automatically sourced from Octopus.Release.Number, though. Why did I have to create an Octo var and set it?
-
The automatic sourcing actually only happens for the older ReadyRoll way of creating an Octopus package (where the .nupkg is created as part of the Visual Studio build - https://documentation.red-gate.com/sca3/automating-database-changes/automated-deployment-with-sql-change-automation-core/using-octopus-deploy-with-sql-change-automation-core).
When you're using the newer SQL Change Automation step templates this doesn't happen automatically at the moment. -
Thank you, @Mike U! I think this falls under the umbrella of needing to update the docs. I'd be willing to help you and the team with this process. Cheers.
-Peter
Add comment
Please sign in to leave a comment.
$SqlCmdVersionVariables = @{ReleaseVersion = "1.1.0-build 1"}
NewDatabaseRelease ... -SqlCmdVariables $SqlCmdVariables
However, I'm currently not using direct powershell scripts in my process. I'm using the step templates in octopus.
How do I get octopus to populate these columns?
TIA,
-Peter