This is my first foray into octopus deploy so please be gentle
I tried creating a simple powershell step that checks to see if a directory exists and creates that directory. I tried using System.Project.Name variable listed here: http://docs.octopusdeploy.com/display/OD/System+variables by doing the following:
It creates the folder successfully, however the directory name ends up as C:\inetpub.Project.Name
I tried using some of the other system variables and they donâtâ seem to work either
Iâm obviously missing something here and any help would be greatly appreciated!
Iâm running Octopus Deploy 2.4.7/85 and latest version of tentacle.
Duh, close this ticket. It took a bit of reading through the comments on the documentation and also looking through the raw output with the variables OctopusPrintEvaluatedVariables and OctopusPrintVariables enabled before I understood what was going on (sort of).
I created a new simple project test.
I wasnât calling the system variables correctly. You have to assign what youâre calling to a variable --i.e. $var = $OctopusParameters[âsystemvariableâ]
It looks like Octopus is trying to run a powershellscript that doesnât get escaped
properly if you place a nested variable inline - note missing single quite in the raw output.
17:16:47 Verbose | - [Octopus.Step[0].Script.ScriptBody] = '$sitedir=âc:\inetpub$OctopusParameters[âOctopus.Project.Nameâ]â
The only way I could get this working was doing the following:
$sitedir=âc:\inetpubâ + $OctopusParameters[âOctopus.Project.Nameâ]
if (!(test-path -path $sitedir)) { new-item -item directory -path $sitedir}
If someone has an easier way to do this, please let me know.
Anyway hope this helps someone else that is just getting startedâŚ,