How can we help you today? How can we help you today?

Populate release_version and/or package_version?

I'm now able to populate the release_version column in the __migration Log table via powershell using:

$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
PeterDaniels
0

Comments

7 comments

  • Mike U
    Any Octopus variable will automatically be converted into a SqlCmd variable
    Mike U
    0
  • PeterDaniels
    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...
    PeterDaniels
    0
  • Monday
    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.

    Monday
    0
  • PeterDaniels

    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...

    PeterDaniels
    0
  • PeterDaniels
    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?
    PeterDaniels
    0
  • Mike U
    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.
    Mike U
    0
  • PeterDaniels
    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
    PeterDaniels
    0

Add comment

Please sign in to leave a comment.