如何在PowerShell中添加Atlassian Bamboo变量?

时间:2016-11-08 14:30:30

标签: powershell bamboo

我很难解决这个问题,我有以下的powershell脚本,简单的一个:

$BambooPath = 'C:\StartFolder\*'
$RemoteWebPath = 'C:\DestFolder'
Copy-Item -Path $BambooPath -Destination $RemoteWebPath -Recurse

我不想用$ BambooPath替换C:\ StartFolder * $ {bamboo.build.working.directory} *变量......任何人都知道如何做到这一点?

2 个答案:

答案 0 :(得分:3)

使用下划线代替点来访问Bamboo环境变量:

$BambooPath = $Env:bamboo_build_working_directory
$RemoteWebPath = 'C:\DestFolder'
Copy-Item -Path $BambooPath -Destination $RemoteWebPath -Recurse

答案 1 :(得分:0)

如果你有内联PS脚本,你可以指定参数(有Argument字段):

Attempting transition to customer.index
Preparing to transition from 'customer.goodie-pack' to 'customer.index'
Transition #1: customer.index: calling beforeModel hook
Transition #1: customer.index: calling deserialize hook
Transition #1: customer.index: calling afterModel hook
Transition #1: Resolved all models on destination route; finalizing transition.
Transitioned into 'customer.index'
Transition #1: TRANSITION COMPLETE.

并添加您的脚本应该是

-BambooPath ${bamboo.build.working.directory}