Hi!
I have a problem with running a batch file under windows Bamboo agent. Here is the batch:
set git_exe="C:\Program Files (x86)\Git\cmd\git.exe" set build_type=%1 set git_repo=%2 if %build_type% == Release ( for /f "delims=" %%i in ('UpdateVersion.exe -i Properties\AssemblyInfo.cs -w -r Fixed') do set version=%%i %git_exe% tag %version% %git_exe% push --tags %git_repo% UpdateVersion.exe -i Properties\AssemblyInfo.cs -o Properties\AssemblyInfo.cs -v Assembly -r increment UpdateVersion.exe -i Properties\AssemblyInfo.cs -o Properties\AssemblyInfo.cs -v File -r increment %git_exe% add -u for /f "delims=" %%j in ('UpdateVersion.exe -i Properties\AssemblyInfo.cs -w -r Fixed') do set new_version=%%j %git_exe% commit -m "Next development iteration [v.%new_version%]" %git_exe% push %git_repo% master )
When the batch is run from the windows cmd - evertythings is fine:
[master warning: LF will be replaced by CRLF in Properties/AssemblyInfo.cs. The file will have its original line endings in your working directory. b1e6ce7] Next development iteration [v.1.0.0.8] warning: LF will be replaced by CRLF in Properties/AssemblyInfo.cs. The file will have its original line endings in your working directory. 1 file changed, 2 insertions(+), 2 deletions(-) Counting objects: 7, done. Delta compression using up to 4 threads. Compressing objects: 100% (3/3), done. Writing objects: 100% (4/4), 377 bytes | 0 bytes/s, done. Total 4 (delta 2), reused 0 (delta 0) To ssh://git@git.exmaple.com:7999/project/repo.git a040944..b1e6ce7 master -> master
But when the batch is run from Bamboo (either inline or cmd), variables %version% and %new_version% are not substituting:
build 18-Mar-2014 18:47:37 [master a040944] Next development iteration [v.] error 18-Mar-2014 18:47:37 warning: LF will be replaced by CRLF in Properties/AssemblyInfo.cs. build 18-Mar-2014 18:47:37 1 file changed, 2 insertions(+), 2 deletions(-) error 18-Mar-2014 18:47:37 The file will have its original line endings in your working directory. error 18-Mar-2014 18:47:37 warning: LF will be replaced by CRLF in Properties/AssemblyInfo.cs. error 18-Mar-2014 18:47:37 The file will have its original line endings in your working directory. error 18-Mar-2014 18:47:37 To ssh://git@git.exmaple.com:7999/project/repo.git error 18-Mar-2014 18:47:37 ecec679..a040944 master -> master
Please, advise!
Found the problem and solution. It seems than while executing from Bamboo, any variable that is set in FOR loop stays in loop and is not visible from outside.
So - the solution is to move %git_exe% tag %version% and %git_exe% commit -m "Next development iteration [v.%new_version%]" to loop.
Possibly, initiating variables before loop will help, though didn't test that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.