Scope
We are using Octopus Deploy 3.2.6 for our continuous deployment process. We would like to setup and automated email that sends our stake holders with 30 minute in advance for any deployment jobs. An email will look something similar to this.
Unfortunately this cannot be easily achieved as Octopus Deploy do not have any system variables that can print out the current time.
Solution
Although there are no system variables readily available to us, but we can make our own variables by using output variables.
In our deployment process, we add an extra step before our email process that will initialize any system variables we want.
We can use powershell scripts to get the system time, and store as an octopus output variable.
$now = [System.DateTime]::Now.ToString("f") Set-OctopusVariable -name "CurrentDateTime" -value $now
In our email body, we can then reference the current time like this.
#{Octopus.Action[Init System Variables].Output.CurrentDateTime}
And the result will looks like this.
Conclusion
It was a lot of efforts just to get the current time. However, this is very now flexible as I can use anything that are gettable via PowerShell.