lockable-resources-plugin icon indicating copy to clipboard operation
lockable-resources-plugin copied to clipboard

In version 2.0 can't execute Windows batch or Ant script

Open YuriyGorvitovskiy opened this issue 8 years ago • 4 comments

I have a problem to use version 2.0 on Windows Server 2008. After locking resources with name dev-build-sql I can't execute Windows batch or call Ant script. I'm getting java error:

[lockable-resources] acquired lock on [dev-build-sql] Building in workspace D:\jenkins\jobs\Test-lock\workspace [workspace] $ cmd /c call C:\Users\CSIDEV\AppData\Local\Temp\jenkins583201663619856164.bat The parameter is incorrect FATAL: command execution failed java.io.IOException: CreateProcess error=87, The parameter is incorrect at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.(Unknown Source) at java.lang.ProcessImpl.start(Unknown Source) Caused: java.io.IOException: Cannot run program "cmd" (in directory "D:\jenkins\jobs\Test-lock\workspace"): CreateProcess error=87, The parameter is incorrect at java.lang.ProcessBuilder.start(Unknown Source) at hudson.Proc$LocalProc.(Proc.java:245) at hudson.Proc$LocalProc.(Proc.java:214) at hudson.Launcher$LocalLauncher.launch(Launcher.java:850) at hudson.Launcher$ProcStarter.start(Launcher.java:384) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:109) at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66) at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20) at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:730) at hudson.model.Build$BuildExecution.build(Build.java:206) at hudson.model.Build$BuildExecution.doRun(Build.java:163) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:490) at hudson.model.Run.execute(Run.java:1735) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:415) Build step 'Execute Windows batch command' marked build as failure [lockable-resources] released lock on [dev-build-sql] Finished: FAILURE

In case no lock is set batch executed successfully. I suspect that setting environment variable during resource lock operation is causing the error. Either the name of the environment variable is not compatible with windows environment, or the value is too long. 
 Changing resource name to DEV_BUILD_SQL didn't help. 

Forced to rollback to the plugin version 1.10.

YuriyGorvitovskiy avatar Jun 05 '17 00:06 YuriyGorvitovskiy

I'm having the same problem in version 2.1

PatrickRUG avatar Nov 16 '17 14:11 PatrickRUG

Ditto. Any workarounds?

Nadav-Ruskin avatar Jan 18 '18 09:01 Nadav-Ruskin

Workaround: This plugin is pretty much a duplicate of lockable resources. I've tested it for a while and it seems to work fine.

https://wiki.jenkins.io/display/JENKINS/Exclusion-Plugin

Nadav-Ruskin avatar Jan 21 '18 08:01 Nadav-Ruskin

Can somebody check it with latest release? I test the plugin on Windows (built-in) and Windows (agent) and it works as expected. Also we use Unix (built-in) and several operating systems as agents. And it works.

Probably same as here #52

mPokornyETM avatar Dec 08 '22 14:12 mPokornyETM