<< Back to previous view

[QB-654] Build step is failed on build agent (on Windows)
Created: 28/Sep/10  Updated: 05/Oct/10

Status: Resolved
Project: QuickBuild
Component/s: None
Affects Version/s: 3.0.6
Fix Version/s: 3.0.10

Type: Bug Priority: Trivial
Reporter: Alexey Shumkin Assigned To: Unassigned
Resolution: Fixed Votes: 0
Remaining Estimate: Unknown Time Spent: Unknown
Original Estimate: Unknown
Environment: QB server Windows 2003 Server R2
QB build agent - Windows XP SP2, Windows 2008 Server


 Description   
Run QB server. Run QB builder agent on another machine (I tested on two different ones)
Steps
1. Create test configuration
2. Create first step
Name build
Type Shell/Batch Command
Execute Condition If all previous sibling steps are successful
Node Selection On the same node running parent step (on server if no parent)
Command cmd /c echo echo build started > build.cmd
Wait For Finish yes
3. Create second step
Name run-on-node
Type Shell/Batch Command
Execute Condition If all previous sibling steps are successful
Node Selection On specified build agent
Build Agent NEAN2:8811
Command build.cmd
Fetch Input Files
Files To Transfer build.cmd
4. Run the configuration

Build fails with error
21:15:08,708 [master>run-on-node@NEAN2:8811] ERROR - Step 'run-on-node' is failed.
    java.lang.RuntimeException: java.io.IOException: Cannot run program "build.cmd" (in directory "D:\Program Files\QBuildAgent\workspace\root\test-nodes"): CreateProcess error=2, ?? ??????? ????? ????????? ????
        at com.pmease.quickbuild.execution.CommandExecutor.runAndGetResult(CommandExecutor.java:215)
        at com.pmease.quickbuild.plugin.basis.CommandBuildStep.run(CommandBuildStep.java:228)
        at com.pmease.quickbuild.plugin.basis.CommandBuildStep$$EnhancerByCGLIB$$68f44831.CGLIB$run$11(<generated>)
        at com.pmease.quickbuild.plugin.basis.CommandBuildStep$$EnhancerByCGLIB$$68f44831$$FastClassByCGLIB$$c5bbde35.invoke(<generated>)
        at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:215)
        at com.pmease.quickbuild.DefaultScriptEngine$Interpolator.intercept(DefaultScriptEngine.java:271)
        at com.pmease.quickbuild.plugin.basis.CommandBuildStep$$EnhancerByCGLIB$$68f44831.run(<generated>)
        at com.pmease.quickbuild.stepsupport.Step.execute(Step.java:449)
        at com.pmease.quickbuild.stepsupport.StepJob.execute(StepJob.java:34)
        at com.pmease.quickbuild.grid.GridJob.run(GridJob.java:120)
        at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: Cannot run program "build.cmd" (in directory "D:\Program Files\QBuildAgent\workspace\root\test-nodes"): CreateProcess error=2, ?? ??????? ????? ????????? ????
        at java.lang.ProcessBuilder.start(Unknown Source)
        at com.pmease.quickbuild.execution.CommandExecutor.runAndGetResult(CommandExecutor.java:213)
        ... 10 more
    Caused by: java.io.IOException: CreateProcess error=2, ?? ??????? ????? ????????? ????
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(Unknown Source)
        at java.lang.ProcessImpl.start(Unknown Source)
        ... 12 more

if second step (see step 3) Command change to "${configuration.getWorkspaceDir()}\build.cmd" (without quotes) build succeeds
21:15:30,352 [master>run-on-node@NEAN2:8811] INFO - Running step...
21:15:30,356 [master>run-on-node@NEAN2:8811] DEBUG - Executing command: D:\Program Files\QBuildAgent\workspace\root\test-nodes\build.cmd
21:15:30,356 [master>run-on-node@NEAN2:8811] DEBUG - Command working directory: D:\Program Files\QBuildAgent\workspace\root\test-nodes
21:15:30,419 [master>run-on-node@NEAN2:8811] INFO -
21:15:30,420 [master>run-on-node@NEAN2:8811] INFO - D:\Program Files\QBuildAgent\workspace\root\test-nodes>echo build started
21:15:30,421 [master>run-on-node@NEAN2:8811] INFO - build started
21:15:30,428 [master>run-on-node@NEAN2:8811] INFO - Executing post-execute script...

Error log message "in directory "D:\Program Files\QBuildAgent\workspace\root\test-nodes"" points to me that it is the current directory for run build.cmd, but as for the fact it is not?

 Comments   
Comment by Robin Shen [ 29/Sep/10 12:36 AM ]
Working directory of batch/shell build step will not used to search executables as explained in the property description. If you substitute the command with "cmd /c build.cmd", the step will succeed even without prepending the full path.
Comment by Alexey Shumkin [ 29/Sep/10 06:32 AM ]
Yesh, you're right about .cmd
But actual problem was I could not run .exe-file. Example above was simplified attempt to reproduce the problem.

Replace command of first step (see above step2 ) "cmd /c copy d:\temp\BeelineBillAnalysisTests.exe ." (w/o quotes)
So we take known file (console test application in this case) and copy it to configuration workspace (we can replace this with building of an app to workspace dir but for the test I don't wanna wait until application is built)

And then command of step 2 (see above step 3) is "BeelineBillAnalysisTests.exe"
and we've got
10:21:47,206 [master>run-on-node@NEAN2:8811] INFO - Fetching input files...
10:21:47,347 [master>run-on-node@NEAN2:8811] INFO - Running step...
10:21:47,349 [master>run-on-node@NEAN2:8811] DEBUG - Executing command: BeelineBillAnalysisTests.exe
10:21:47,350 [master>run-on-node@NEAN2:8811] DEBUG - Command working directory: D:\Program Files\QBuildAgent\workspace\root\test-nodes
10:21:47,353 [master>run-on-node@NEAN2:8811] INFO - Executing post-execute script...
10:21:47,354 [master>run-on-node@NEAN2:8811] ERROR - Step 'run-on-node' is failed.
    java.lang.RuntimeException: java.io.IOException: Cannot run program "BeelineBillAnalysisTests.exe" (in directory "D:\Program Files\QBuildAgent\workspace\root\test-nodes"): CreateProcess error=2, ?? ??????? ????? ????????? ????
        at com.pmease.quickbuild.execution.CommandExecutor.runAndGetResult(CommandExecutor.java:215)
        at com.pmease.quickbuild.plugin.basis.CommandBuildStep.run(CommandBuildStep.java:228)
        at com.pmease.quickbuild.plugin.basis.CommandBuildStep$$EnhancerByCGLIB$$68f44831.CGLIB$run$11(<generated>)
        at com.pmease.quickbuild.plugin.basis.CommandBuildStep$$EnhancerByCGLIB$$68f44831$$FastClassByCGLIB$$c5bbde35.invoke(<generated>)
        at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:215)
        at com.pmease.quickbuild.DefaultScriptEngine$Interpolator.intercept(DefaultScriptEngine.java:271)
        at com.pmease.quickbuild.plugin.basis.CommandBuildStep$$EnhancerByCGLIB$$68f44831.run(<generated>)
        at com.pmease.quickbuild.stepsupport.Step.execute(Step.java:449)
        at com.pmease.quickbuild.stepsupport.StepJob.execute(StepJob.java:34)
        at com.pmease.quickbuild.grid.GridJob.run(GridJob.java:120)
        at java.lang.Thread.run(Unknown Source)
    Caused by: java.io.IOException: Cannot run program "BeelineBillAnalysisTests.exe" (in directory "D:\Program Files\QBuildAgent\workspace\root\test-nodes"): CreateProcess error=2, ?? ??????? ????? ????????? ????
        at java.lang.ProcessBuilder.start(Unknown Source)
        at com.pmease.quickbuild.execution.CommandExecutor.runAndGetResult(CommandExecutor.java:213)
        ... 10 more
    Caused by: java.io.IOException: CreateProcess error=2, ?? ??????? ????? ????????? ????
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(Unknown Source)
        at java.lang.ProcessImpl.start(Unknown Source)
        ... 12 more

Is it expected behaviour? As for me it is not

And, yes, it works again "cmd /c BeelineBillAnalysisTests.exe" but it is a workaround, is not it? What am I missing? Why application cannot be run in a current folder without command shell?
Comment by Robin Shen [ 29/Sep/10 06:36 AM ]
The reason behind this is that the current directory specified for command is not included (which is a JDK ProcessBuilder limitation) in PATH to search for command itself. The workflow is to find command first then set its working directory.
Comment by Robin Shen [ 01/Oct/10 12:40 PM ]
We can probably enhance QuickBuild to prefix the command with path of working directory automatically to make it less confusing.
Generated at Fri May 17 04:06:34 UTC 2024 using JIRA 189.