1

I'm working with Octopus and I need to add in one of my PowerShell scripts the chance to modify an Octopus Parameter (not Variable...). In few words, my website deploys in 2 folders, alternately, and I have to take a trace of this. My idea is to set a parameter that, at every run of the script reads the actual value and so knows where to deploy this new release.

I also tried some stuff such as

$OctopusParameters['Destination']=$Number

and

Set-OctopusVariable -Name 'Destination' -Value $Number

but without success.

I hope I've been clear enough and thanks in advance for everyone will reply.

2
  • 1
    I've read this a couple of times and I'm not understanding what your goal is. Setting the $OctopusParameters will only have effect in your script. What do you want to use the value for? Where do you want to use it? Commented Apr 24, 2015 at 13:34
  • Hi, this variable represents a sort of global state that should be persistent through the deploys. It has the task of taking trace of the current folder in which my website is deployed - it will change between 2 everytime i deploy... Is now more clear? Commented Apr 24, 2015 at 19:43

1 Answer 1

4

You might want to try setting an environmental variable on the machine for this. It will persist between deployments.

Edit:

Can't format this in the comment very well, you probably want something like this

$destination = [environment]::GetEnvironmentVariable("Destination","Machine")

// change $destination to its opposite value

[Environment]::SetEnvironmentVariable("Destination",$destination,"Machine")
Sign up to request clarification or add additional context in comments.

3 Comments

Ok, I did this, but my goal is to modify this environmental variable at every deploy through the powershell script.
Hi again, I tried to use the Set command, where I have to fill with Machine I put Machine's name in Environment, but seems not to recognize it.
"Machine" is what you should use. It's the scope of the variable. The options are "Machine", "User", or "Process"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.