0
votes

I want to make a deploy on a bamboo using msdeploy.exe.

I configure a command to run msdeploy.exe on an agent and try to run it with an argument:

-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

This command works well from my local cmd.

However, on a bamboo I got an error:

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

I tried few things but without a success:

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..."

Bamboo documentations says to use: "Argument you want to pass to the command. Arguments with spaces in them must be quoted" However I already quoted my parameter.

1

1 Answers

0
votes

It's probabaly because of 5 years old bamboo issue: https://jira.atlassian.com/browse/BAM-10740

As a workaround you can create powershell script which takes paths as an input parameters and execute it from bamboo eg:

Synchronize.ps1 script:

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

And add bamboo powershell script task Synchronize.ps1 with parameters eg:

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

The drawback is that you must make sure that web deploy is available on agent host eg. by adding dummy web deploy dump task if you are running bamboo older than 5.13.