You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it took me a while to figure out how I can use tasks to set Enviroment Variables which can be used during the whole deployment. I first tried the following
Deploy {
By Task Set-Enviroment {
$Env:Enviroment = "Dev"
$Env:InstPath = "C:\Web\Precompiled\$Env:Enviroment.Website"
Tagged Dev
}
By Noop Test {
FromSource dist
To $Env:InstPath
DependingOn Set-Enviroment
}
}
unfortunately this did not work out "By Noop Test" did not know anything about my enviroment variables. What worked out for me is to put the Enviroment variable within the task into the FromSource part like that:
Deploy {
By Task Set-Enviroment {
FromSource {
$Env:Enviroment = "Dev"
$Env:InstPath = "C:\Web\Precompiled\$Env:Enviroment.Website"
}
Tagged Dev
}
By Noop Test {
FromSource dist
To $Env:InstPath
DependingOn Set-Enviroment
}
}
The documentation does not say anything about that. I would like to complete the documentation but I dont know how it acutally is intended to be working? Is my approach by putting it into the FromSource correct?
The text was updated successfully, but these errors were encountered:
Strange! I'll play around with it when I have a few minutes, might be a little while (about to head out of town).
Long story short, each layer dot sources the scriptblock... so in your working example:
Deploy sets up collection and...
Dot sources scriptblock for By Task
Dot sources nested FromSource
Dot sources scriptblock for By Noop
Something might be off in the logic - it seems like you should see the env bits you set even in your first example, as long as the task runs first, but there might be some oddity in the code.
Actually the only way it did work out for me in the end is to setup the enviroment variables in a powershell script before i call the Invoke-PSDeploy command. I have not managed to setup enviroment variables in a task so that another part of the psdeploy.ps1 file could pic the variables up then.
Hi,
it took me a while to figure out how I can use tasks to set Enviroment Variables which can be used during the whole deployment. I first tried the following
unfortunately this did not work out "By Noop Test" did not know anything about my enviroment variables. What worked out for me is to put the Enviroment variable within the task into the FromSource part like that:
The documentation does not say anything about that. I would like to complete the documentation but I dont know how it acutally is intended to be working? Is my approach by putting it into the FromSource correct?
The text was updated successfully, but these errors were encountered: