Hi, I am testing a powershell script because I would like to execute some files in the package location so I am trying to output some values with the following script:
I think your PowerShell script is in a PowerShell script step (which unfortunately doesn’t have access to these variables). For the script to work, you’ll need to put it inside of your package, as a Deploy.ps1 or PostDeploy.ps1 script for example. You can learn more about embedding scripts here:
Hi Paul and thank you for your reply.
Yes you are right, I have a sub-step Powershell after the package is downloaded and unpacked on the Client side (Tentacle)
What I am going to do is to iterate through your dictionary from the Nuget script and for the main Powershell step and see what I have on each one.
I will be back and update this thread as soon as I have the results.
The Single Powershell step (not child) doesn’t display all the info
[code]Tentacle script execution
Deploy Information
Deploying application:
Clientele_ITSM
Version:
2014.1
Package version:
2014.1.49
Deploy Location
Path:
Machine: [/code]
But if I execute the script within the package (Pre, Post or deployment.ps1) all the variables are properly populated.
At this point I would suggest to mention this in the documentation cause when you create a powershell script, it seems obvious that the variables will be there
I look at the issue on GITHUB and did not see anyone working on this. Do we have a tentative date for a solution…
I know a specific date cannot be given but I’ve got a temporary solution in place (using the Octopus variables only) and if the solution is going to take awhile then I will have to change to putting the code in a Deploy.ps1 script and have it executed from there…
Thanks for getting in touch! I am a bit confused about your response. The GitHub issue linked was indeed completed and released.
Could you please provide specific details on your issue, what you are seeing or expect to see, a deployment log, and what version of Octopus and Tentacle you have installed.
There was also a blog post that explains what was added and updated and how to use the variables:
We are currently running Octopus and Octopus tentacle 2.5.7.384 and we are still experiencing the problem with getting variables populated. Currently I am working on trying to writing a Powershell script that will eventually become the post deployment script for deploying things to Azure. I am trying to see if it possible to use the variables within the Variable set that we’ve set up instead of duplicating them in a text or another powershell file within the VS studio project. Here is the sample of that code
Write-Host ‘Looking for and display Octopus variables’
$drnLocalDNS = $OctopusParameters[‘Octopus.Acquire.MaxParallelism’]
$sktContent = $OctopusParameters[“SKTContext”]
Write-Host "DNS-Local is: $drnLocalDNS"
Write-Host “SKTContent is: $sktContent”
you see i am trying to get a environment variable in one case and a variable we created in another…in both cases I do not get anything back. I am running this script threw the run-script portion of the Octopus Tentacle. This is also happen withn I have a script with a deployment step/process.
Where are you setting SKTContext?
To troubleshoot this you could add Write-Host $OctopusParameters and it will dump all of the available parameters scoped for that step.
This might allow you to troubleshoot this.
Also I noticed you have $sktContent = $OctopusParameters["SKTContext"] are Content and Context both, or is the second a typo and should be Content ?
SKTContext is a variable I set in the Library Variable Set…I would like to access these variables when executing a PostDeploy.ps1 file…it would prevent me from creating a properties file.
I will try to the dump to see if i come up with anything
No…it is not a typo…i want to put the value of the Octopus variable into the powershell variable within the script
I don’t know if I understand your comment. The GitHub issue and the overall problem in this thread has been resolved and is working.
If you are having specific problems with variables could you provide the information, any support documentation such as screenshots or powershell and we can try to help you with your variables not working.
Perhaps it was a mistake from my end. I was trying to access variables ?in powershell as #{variablename}. But now I have corrected that by using $variablename and found its working fine.
Not a problem at all, I am glad you figured this out. The variables usage can be confusing as it is used in 3 different ways depending on where you need it resolved.