Search code examples
octopus-deploy

Access Octopus Deploy's System Variable in SQL script


If I use the "Execute SQL Script Template" the following SQL works:

Print N'#{MyVariable}'

This prints out "Hello World" if I set MyVariable to "Hello World" in the variables of the project.

However

Print N'#{Octopus.Deployment.Id}'

Prints out exactly that. How do I get it to print out Octopus system level variables?

Note that this question is not specific to getting the Deployment Id. Just how to get Octopus variables in my SQL script in general


Solution

  • This was due to an old (2018) version of Octopus. Upgrading to the latest version would solve the issue