Windows build slave cannot run hg

691 views
Skip to first unread message

Jerry

unread,
Jun 10, 2011, 10:26:00 AM6/10/11
to Jenkins Users
Hi, I've just set up a new Windows build slave. When I try to run a
test job, I get the following:

*****
Started by user builder
Building remotely on gunter
$ hg clone --rev default ssh://scm//opt/hg/test/Test C:\jenkins
\dailyBuild\workspace\test
remote: '"TortoisePlink.exe"' is not recognized as an internal or
external command,
remote: operable program or batch file.
abort: no suitable response from remote hg!
ERROR: Failed to clone ssh://scm//opt/hg/test/Test
[test] $ hg log --rev . --template {node}
java.io.IOException: Cannot run program "hg" (in directory "C:\jenkins
\dailyBuild\workspace\test"): CreateProcess error=267, The directory
name is invalid
at java.lang.ProcessBuilder.start(Unknown Source)
...
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: CreateProcess error=267, The directory
name is invalid
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 17 more
Sending e-mails to: [me]
Finished: FAILURE
*****


HG works just fine when I log in to the slave machine and run it.
I've got the path to both TortoisePlink and hg.exe in my path (excerpt
from the System Information page):
*****
System Properties
...
Path | C:\bin\apache-ant-1.8.2\bin;C:\Program Files\Java
\jdk1.6.0_23\bin;C:\Program Files\Java\jdk1.6.0_23\jre\bin;C:\Perl
\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows
\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\Microsoft SQL
Server\90\Tools\binn\;C:\Program Files\Microsoft Windows Performance
Toolkit\;C:\Program Files\TortoiseHg\;
*****


If I go to the script console for the slave machine and run:
*****
println System.getenv("PATH")
*****

I get the expected result:
*****
Result

C:\bin\apache-ant-1.8.2\bin;C:\Program Files\Java\jdk1.6.0_23\bin;C:
\Program Files\Java\jdk1.6.0_23\jre\bin;C:\Perl\bin;C:\Windows
\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows
\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\Microsoft SQL
Server\90\Tools\binn\;C:\Program Files\Microsoft Windows Performance
Toolkit\;C:\Program Files\TortoiseHg\;
*****


If I then run the script:

*****
def command = "hg help"
def proc = command.execute()
proc.waitFor()

println "return code: ${ proc.exitValue()}"
println "stderr: ${proc.err.text}"
println "stdout: ${proc.in.text}"
*****

I can wait many minutes, but get no response.

What do I have to configure to get the slave to recognize the path to
hg?

Thanks,
Jerry

clhpoole

unread,
Jun 20, 2011, 9:54:36 PM6/20/11
to Jenkins Users
Hi Jerry,

Have you made any progress on this? I'm working on a windows slave
configuration with hg. I may be able to help some, but I'm still
figuring this out myself. Of course I can't help right away without
asking a bunch of questions.

Are you running Jenkins on the slave as a windows service?

It looks like the clone is your first command - is this Jenkins
cloning to do SCM? Can you run hg in a job that Jenkins is not using
SCM? The environment when Jenkins is doing the clone itself is not
the same as it is in the build script. My build is OK when I don't
have Jenkins do the clone, but it fails when I have Jenkins doing SCM
management.

There is an error that looks like it can't find tortoisePlink.exe.
That is used for ssh. An alternative is to use openssh that comes
with cygwin. That's what I'm doing, so I haven't seen this problem. It
is finding hg, so I don't know why it wouldn't find tortoisePlink.
Just add "ssh = /usr/bin/ssh -C" in the mercurial.ini file and
the .hgrc in the cygwin home dir (I don't really know which one is
needed because I have it set in both). You have to explicitly mark
openssh to be installed when installing cygwin.

The script you are running in the console doesn't work for me either.
It doesn't work with the command "dir" or "ls", so I don't know what
is happening here. I don't know groovy so I'm just copying your
script.

After that there is this message:
java.io.IOException: Cannot run program "hg" (indirectory"C:\jenkins
> \dailyBuild\workspace\test"): CreateProcess error=267, Thedirectorynameisinvalid

Which is where I am at. My build script works when I'm not using
Jenkins SCM. The build fails with a message like that when Jenkins is
trying to clone the repository.

I'll keep you posted on my progress.

-Cheryl

On Jun 10, 7:26 am, Jerry <gpjerrymalo...@gmail.com> wrote:
> Hi, I've just set up a new Windows build slave.  When I try to run a
> test job, I get the following:
>
> *****
> Started by user builder
> Building remotely on gunter
> $ hg clone --rev default ssh://scm//opt/hg/test/Test C:\jenkins
> \dailyBuild\workspace\test
> remote: '"TortoisePlink.exe"' is not recognized as an internal or
> external command,
> remote: operable program or batch file.
> abort: no suitable response from remote hg!
> ERROR: Failed to clone ssh://scm//opt/hg/test/Test
> [test] $ hg log --rev . --template {node}
> java.io.IOException: Cannot run program "hg" (indirectory"C:\jenkins

Jerry

unread,
Jun 24, 2011, 3:55:36 PM6/24/11
to Jenkins Users
Hi, Cheryl. I have solved my specific question above, though I'm not
out of the woods yet (having a weird java.lang.OutOfMemoryError on
certain jobs, but only in Jenkins). Anyhow --

> Are you running Jenkins on the slave as a windows service?
This, along with using explicit paths for ant on both master and
slave, resolved most of my problems. I found that using the default
ant led to weird issues like "Cannot run program 'hg'", even though
each machine has only one installation of ant.

So for you I'd suggest you go to the configuration for master and,
under Ant > Ant installations, add { "Name": "ant", "ANT_HOME": "C:/
path/to/ant/on/the/master/apache-ant-1.8.2" }.
Now go to the slave's configuration. Under Node Properties > Tool
Locations add a tool: { "Name": "(Ant) ant":, "Home": "C:/path/to/ant/
on/the/slave/apache-ant-1.8.2" }

That did the trick for me. Seems like it shouldn't have done anything
since I had no other ant installations and ant.bat was in the path,
but there it is.

Hope this helps,
Jerry
Reply all
Reply to author
Forward
0 new messages