1

my Jenkins job fails as it gives this error message:

hudson.util.IOException2: Failed to locate Cygwin installation. Is Cygwin installed?
at hudson.plugins.cygpath.CygpathLauncherDecorator$GetCygpathTask.getCygwinRoot(CygpathLauncherDecorator.java:138)
at hudson.plugins.cygpath.CygpathLauncherDecorator$GetCygpathTask.call(CygpathLauncherDecorator.java:142)
at hudson.plugins.cygpath.CygpathLauncherDecorator$GetCygpathTask.call(CygpathLauncherDecorator.java:112)
at hudson.remoting.LocalChannel.call(LocalChannel.java:45)
at hudson.plugins.cygpath.CygpathLauncherDecorator$1.getCygpathExe(CygpathLauncherDecorator.java:104)
at hudson.plugins.cygpath.CygpathLauncherDecorator$1.cygpath(CygpathLauncherDecorator.java:86)
at hudson.plugins.cygpath.CygpathLauncherDecorator$1.launch(CygpathLauncherDecorator.java:65)
at hudson.Launcher$ProcStarter.start(Launcher.java:381)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:97)
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:770)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:160)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:533)
at hudson.model.Run.execute(Run.java:1759)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:89)
at hudson.model.Executor.run(Executor.java:240)
Caused by: hudson.util.jna.JnaException: Win32 error: 2 - The system cannot find the file specified
at hudson.util.jna.RegistryKey.check(RegistryKey.java:124)
at hudson.util.jna.RegistryKey.open(RegistryKey.java:223)
at hudson.util.jna.RegistryKey.openReadonly(RegistryKey.java:218)
at hudson.plugins.cygpath.CygpathLauncherDecorator$GetCygpathTask.getCygwinRoot(CygpathLauncherDecorator.java:127)
... 18 more

Im running Jenkins on windows and want to run the scripts in this github repo: https://github.com/y0u-s/test

I have the Jenkins shell program path set to: C:\cygwin64\bin\bash

I am stuck at this right now, what can I do to resolve this problem?

Sathyajith Bhat
  • 61,504
  • 38
  • 179
  • 264
Richard
  • 11
  • 2
  • Add the cygwin DLL somewhere in the path. – Romeo Ninov Jan 19 '15 at 12:58
  • In my Windows system variables or in the Jenkins configuration? And what DLL file? Cygwin1.dll? – Richard Jan 19 '15 at 13:36
  • As far as I know Jenkins use Windows PATH's so put cygwin1.dll in PATH or in the same directory where is Jenkins jar itself – Romeo Ninov Jan 19 '15 at 13:40
  • Nope, Im still getting the error message. Could it be something else? – Richard Jan 19 '15 at 13:45
  • Have you try this plugin: https://wiki.jenkins-ci.org/display/JENKINS/Cygpath+Plugin – Romeo Ninov Jan 19 '15 at 13:47
  • Yes I have downloaded that already. – Richard Jan 19 '15 at 13:49
  • Check lease this discussion: http://stackoverflow.com/questions/731705/can-i-use-cygwin-to-script-a-hudson-build-step – Romeo Ninov Jan 19 '15 at 13:50
  • I have already seen that discussion, but I dont really know if I have to put: '#!/bin/sh ls ${WORKSPACE}' literally above the script, or else, what directory should I insert in WORKSPACE? – Richard Jan 19 '15 at 14:11
  • WORKSPACE is set by Jenkins. And it point to working directory of the job you run – Romeo Ninov Jan 19 '15 at 14:12
  • Could you please check out my git project and show me what I can do in my case? Please bear with me as I am a beginner :) – Richard Jan 19 '15 at 14:22
  • Richard, why do not start working only with CMD. You have already some cmd scripts for mocha. For deploy script there is good one in Jenkins I am sure you can use – Romeo Ninov Jan 19 '15 at 14:31
  • Because I followed a tutorial that is apparently linux-based. http://code.tutsplus.com/tutorials/setting-up-continuous-integration-continuous-deployment-with-jenkins--cms-21511. What do you mean with the last part? Thanks for your help by the way – Richard Jan 19 '15 at 14:35
  • If you mean deploy process it is not so complicated. On target server create script with all command after ssh and before EOF. And run it on this way: ssh user@host -c /path/to/the/script/on/remote/host/script.sh . So this will be the command of deploy – Romeo Ninov Jan 19 '15 at 14:41
  • I already have something like that in my deploy folder, as you can see in the repo – Richard Jan 19 '15 at 16:28

1 Answers1

0

OK I'm going to be posting this solution in a couple places as this is what worked for me and this issue appears in a couple questions. Unfortunately the solution requires some registry editing.

TLDR Solution:

- Make sure cygwin is installed
- Open regedit.
- Go to HKEY_LOCAL_MACHINE - SOFTWARE - Wow6432Node
- Right click on Wow6432Node New->Key name it Cygwin
- Right click on Cygwin New->Key name it setup
- Right click on setup New->String Value name it rootdir
- Right click on rootdir Modify set it to your cygwin folder mine was "C:\cygwin64"

The reasoning

https://github.com/jenkinsci/cygpath-plugin/blob/master/src/main/java/hudson/plugins/cygpath/CygpathLauncherDecorator.java

Is the Jenkins code for how it finds Cygwin. Line 115 is the start of a for loop where it looks initially in the SOFTWARE\Wow6432Node, then in SOFTWARE for the Cygwin directory. In my case I already had "SOFTWARE\Cygwin\setup\rootdir Only it does not seem to be able to find it. I hazard there is some issue where it exits the loop early or does not check the SOFTWARE directory correctly. Using the solution posted above is an unpleasant work around to this issue.

John Duskin
  • 103
  • 3