Set environment variable or parameter from a job

626 views
Skip to first unread message

Scott Landers

unread,
Aug 5, 2015, 10:10:07 PM8/5/15
to go-cd
Does any know if you can set a parameter or environment variable while running a job or can these only be set prior to running the job? I have a scenario where I would like to execute a powershell script and retrieve a value from it and use it as a variable in another job.

Thanks!

Scott

Ketan Padegaonkar

unread,
Aug 5, 2015, 11:42:42 PM8/5/15
to go-cd
Using something from one job in another job in the same pipeline is counter to go's model of pipelines. For the sake of this conversation, I'm going to assume that this is NOT the case you're dealing with.

The recommended way to achieve sharing of environment variables across stages or pipelines is to export the variable in a file and read the variable in the next stage inside your powershell script. Some context and details in this conversation.

--
You received this message because you are subscribed to the Google Groups "go-cd" group.
To unsubscribe from this group and stop receiving emails from it, send an email to go-cd+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Scott Landers

unread,
Aug 7, 2015, 3:56:14 PM8/7/15
to go-cd
Thanks! I thought about writing to a file. I needed the value in the next task. We have a deployment powershell script that is a standard for us and I could have done all of this if I changed that powershell script. I wanted to get the value with a new powershell script and save it to a variable and then use it in the next task.

jle...@ohl.com

unread,
Aug 19, 2015, 12:42:22 PM8/19/15
to go-cd
Are you able to capture the result of your PowerShell script to notify the Stage whether it was successful or failed?
Reply all
Reply to author
Forward
0 new messages