-
Bug
-
Resolution: Low Engagement
-
Low
-
None
-
5.7.0, 5.9.1, 5.10.3
-
4
-
Severity 3 - Minor
-
0
-
The problem can be recreated using a task (e.g. NAnt, Maven, etc) and passing in a parameter whose value includes a space:
NAnt
Options = -v -D:build.number=${bamboo.buildNumber} -D:nunit.path="C:\Program Files (x86)\NUnit 2.6.3\bin\nunit-console.exe"
Maven
Maven goal = -Dtest.password="${bamboo.test.password}"
Bamboo is incorrectly parsing the options and causing the arguments to be called without the enclosing double quotes.
How about using single quotes?
One can try to workaround the problem trying to use single quotes instead of double quotes, like in the example below:
NAnt (Using singles quotes
-D:arg.option='foo' -D:arg.whitespace='foo and bar' -D:nunit.path='C:\Program Files (x86)\NUnit 2.6.3\bin\nunit-console.exe' -D:build.number=${bamboo.buildNumber}
The problem is that the build fails with single quotes because Bamboo ends up adding the quotes as extra characters to the variable value, and if it changes the value it cannot be reliable, see the following examples:
testNUnit.build
<?xml version="1.0"?> <project name="testNUnit"> <target name="run"> <echo message="hello world" /> <echo message="${arg.option}" /> <echo message="${arg.whitespace}" /> <echo message="${nunit.path}" /> <echo message="${build.number}" /> </target> </project>
simple 12-Nov-2014 12:17:30 Build Support - NAnt - Default Job #2 (SUP-NANT-JOB1-2) started building on agent Default Agent simple 12-Nov-2014 12:17:30 Build working directory is D:\ATLASSIAN\home\bamboo-5.7.0\xml-data\build-dir\SUP-NANT-JOB1 simple 12-Nov-2014 12:17:30 Executing build Support - NAnt - Default Job #2 (SUP-NANT-JOB1-2) simple 12-Nov-2014 12:17:30 Running pre-build action: Clover Grails PreBuild Action simple 12-Nov-2014 12:17:30 Running pre-build action: VCS Version Collector command 12-Nov-2014 12:17:30 Substituting variable: ${bamboo.buildNumber} with 2 simple 12-Nov-2014 12:17:30 Starting task 'NAnt' of type 'com.atlassian.bamboo.plugin.dotnet:nant' command 12-Nov-2014 12:17:30 Beginning to execute external process for build 'Support - NAnt - Default Job #2 (SUP-NANT-JOB1-2)'\n ... running command line: \nC:\Program Files (x86)\nant-0.92\bin\nant.exe -buildfile:Nant-Sample-Code\Scripts\testNUnit.build -D:arg.option='foo' -D:arg.whitespace='foo and bar' -D:nunit.path='C:\Program Files (x86)\NUnit 2.6.3\bin\nunit-console.exe' -D:build.number='37' run\n ... in: D:\ATLASSIAN\home\bamboo-5.7.0\xml-data\build-dir\SUP-NANT-JOB1\n ... using extra environment variables: \nbamboo_capability_system_builder_nunit_NUnit_2_6_3=C:\Program Files (x86)\NUnit 2.6.3\bin\nunit-console.exe\nbamboo_capability_system_builder_nunit_NUnit_2_6_3__32bit_=C:\Program Files (x86)\NUnit 2.6.3\bin\nunit-console-x86.exe\nbamboo_buildPlanName=Support - NAnt - Default Job\nbamboo_capability_system_jdk_JDK_1_7=C:\Program Files\Java\jdk1.7.0_67\nbamboo_shortPlanName=NAnt\nbamboo_resultsUrl=http://cosmicdynamo.net/bamboo/browse/SUP-NANT-JOB1-2\nbamboo_system_getTestsToPass=\nbamboo_planKey=SUP-NANT\nbamboo_capability_system_builder_msbuild_MSBuild_v3_5__32bit_=C:\Windows\Microsoft.NET\Framework\v3.5\MSBuild.exe\nbamboo_ManualBuildTriggerReason_userName=admin\nbamboo_shortPlanKey=NANT\nbamboo_shortJobKey=JOB1\nbamboo_capability_system_builder_msbuild_MSBuild_v3_5__64bit_=C:\Windows\Microsoft.NET\Framework64\v3.5\MSBuild.exe\nbamboo_capability_system_builder_nant_Nant=C:\Program Files (x86)\nant-0.92\\nbamboo_build_working_directory=D:\ATLASSIAN\home\bamboo-5.7.0\xml-data\build-dir\SUP-NANT-JOB1\nbamboo_capability_system_jdk_JDK=C:\Program Files\Java\jdk1.7.0_67\nbamboo_shortJobName=Default Job\nbamboo_capability_system_builder_msbuild_MSBuild_v4_0__64bit_=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe\nbamboo_agentId=131073\nbamboo_planName=Support - NAnt\nbamboo_buildResultsUrl=http://cosmicdynamo.net/bamboo/browse/SUP-NANT-JOB1-2\nbamboo_capability_system_builder_msbuild_MSBuild_v2_0__64bit_=C:\Windows\Microsoft.NET\Framework64\v2.0.50727\MSBuild.exe\nbamboo_buildResultKey=SUP-NANT-JOB1-2\nbamboo_capability_system_builder_msbuild_MSBuild_v2_0__32bit_=C:\Windows\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe\nbamboo_capability_system_git_executable=C:\Program Files (x86)\Git\cmd\git.exe\nbamboo_buildKey=SUP-NANT-JOB1\nbamboo_capability_system_jdk_JDK_1_7_0_67=C:\Program Files\Java\jdk1.7.0_67\nbamboo_dependenciesDisabled=false\nbamboo_working_directory=D:\ATLASSIAN\home\bamboo-5.7.0\xml-data\build-dir\SUP-NANT-JOB1\nbamboo_buildNumber=2\nbamboo_agentWorkingDirectory=D:\ATLASSIAN\home\bamboo-5.7.0\xml-data\build-dir\nbamboo_capability_system_builder_msbuild_MSBuild_v4_0__32bit_=C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe\nbamboo_buildTimeStamp=2014-11-12T12:17:30.426-02:00\n build 12-Nov-2014 12:17:31 NAnt 0.92 (Build 0.92.4543.0; release; 09/06/2012) build 12-Nov-2014 12:17:31 Copyright (C) 2001-2012 Gerry Shaw build 12-Nov-2014 12:17:31 http://nant.sourceforge.net build 12-Nov-2014 12:17:31 build 12-Nov-2014 12:17:32 Buildfile: file:///D:/ATLASSIAN/home/bamboo-5.7.0/xml-data/build-dir/SUP-NANT-JOB1/Nant-Sample-Code/Scripts/testNUnit.build build 12-Nov-2014 12:17:32 Target framework: Microsoft .NET Framework 4.0 build 12-Nov-2014 12:17:32 Target(s) specified: run build 12-Nov-2014 12:17:32 build 12-Nov-2014 12:17:32 build 12-Nov-2014 12:17:32 run: build 12-Nov-2014 12:17:32 build 12-Nov-2014 12:17:32 [echo] hello world build 12-Nov-2014 12:17:32 [echo] 'foo' build 12-Nov-2014 12:17:32 [echo] 'foo and bar' build 12-Nov-2014 12:17:32 [echo] 'C:\Program Files (x86)\NUnit 2.6.3\bin\nunit-console.exe' build 12-Nov-2014 12:17:32 [echo] 2 build 12-Nov-2014 12:17:32 build 12-Nov-2014 12:17:32 BUILD SUCCEEDED build 12-Nov-2014 12:17:32 build 12-Nov-2014 12:17:32 Total time: 0.1 seconds. build 12-Nov-2014 12:17:32 simple 12-Nov-2014 12:17:32 Finished task 'NAnt' with result: Success simple 12-Nov-2014 12:17:32 Running post build plugin 'NCover Results Collector' simple 12-Nov-2014 12:17:32 Running post build plugin 'Clover Results Collector' simple 12-Nov-2014 12:17:32 Running post build plugin 'Artifact Copier' simple 12-Nov-2014 12:17:32 Finalising the build... simple 12-Nov-2014 12:17:32 Stopping timer. simple 12-Nov-2014 12:17:32 Build SUP-NANT-JOB1-2 completed. simple 12-Nov-2014 12:17:32 Running on server: post build plugin 'NCover Results Collector' simple 12-Nov-2014 12:17:32 Running on server: post build plugin 'Clover Delta Calculator' simple 12-Nov-2014 12:17:32 Running on server: post build plugin 'Build Hanging Detection Configuration' simple 12-Nov-2014 12:17:32 Running on server: post build plugin 'Maven Dependencies Postprocessor' simple 12-Nov-2014 12:17:32 All post build plugins have finished simple 12-Nov-2014 12:17:32 Generating build results summary... simple 12-Nov-2014 12:17:32 Saving build results to disk... simple 12-Nov-2014 12:17:32 Indexing build results... simple 12-Nov-2014 12:17:32 Finished building SUP-NANT-JOB1-2.
Current Behaviour
... [echo] hello world [echo] 'foo' [echo] 'foo and bar' ...
Required Behaviour, without single quotes
... [echo] hello world [echo] foo [echo] foo and bar ...
Workaround
It looks like the only workaround to this situation is to use double quotes around the entire variable including its reference:
Maven
Maven goal: "-Dtest.password=${bamboo.test.password}"