2016-12-12 39 views
0

我想使用msdeploy.exe在竹上進行部署。如何逃避竹命令任務中的空白空間

我配置的命令在代理 運行msdeploy.exe,並嘗試以參數運行它:

-verb:sync -source:contentPath="${bamboo.build.working.directory}" -dest:contentPath="Default Web Site/application-name",ComputerName="http://server/MSDeployAgentService",userName=user-name,password=password -verbose

該命令從我的本地CMD效果很好。

然而,在竹竿我得到了一個錯誤:

Unrecognized argument '"-dest:contentPath="Default'. All arguments must begin with "-" It suggests that treat "Web.." as a second parameter because of an empty space.

我試過的東西不多,但無一成功:

Encode with %20
"Default Web Site/application-name" -> "Default%20Web%20Site/application-name"
Result - Default%20Web%20Site doesn't exist
This works when I were using msbuild.
Escape with ^
^"Default Web Site/application-name^"
Result: "Unrecognized argument..."
Using single quotes '
'Default Web Site/application-name'
Result: "Unrecognized argument..."

竹單證說,使用:「你想傳遞給參數命令,其中有空格的參數必須被引用「 但是我已經引用了我的參數。

回答

0

這是probabaly因爲5歲的竹問題:https://jira.atlassian.com/browse/BAM-10740

作爲一種變通方法,您可以創建PowerShell腳本這需要路徑作爲輸入參數,並從竹如執行:

Synchronize.ps1腳本:

Param(
[Parameter(Mandatory=$true)] 
[string]$Server, 
[Parameter(Mandatory=$true)] 
[string] $UserName, 
[Parameter(Mandatory=$true)] 
[string] $Password, 
[Parameter(Mandatory=$true)] 
[string]$LocalPath, 
[Parameter(Mandatory=$true)] 
[string]$RemotePath 
) 

Write-Host "Synchronize contents of $RemotePath on host $Server" 

& "C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:contentPath="$LocalPath" -dest:contentPath="$RemotePath",ComputerName="http://$Server/MSDeployAgentService",userName=$UserName,password=$Password -verbose 

並添加竹PowerShell腳本任務Synchronize.ps1與參數如:

-Server ${bamboo.My_Server} -LocalPath '${bamboo.build.working.directory}\Artifacts' -RemotePath 'D:\My app\My folder\' ... 

缺點是您必須確保Web部署在代理主機上可用,例如。如果您運行的是早於5.13的竹節點,則添加虛擬web部署轉儲任務。