开发者

Configuring a Hudson job to run on both Windows and Linux based OS's

开发者 https://www.devze.com 2023-02-17 02:39 出处:网络
I\'m new to Hudson and am working on setting up a job that will build an HG repository of C++ source on multiple platforms.(Linux, Solaris, FreeBSD, and Windows)

I'm new to Hudson and am working on setting up a job that will build an HG repository of C++ source on multiple platforms. (Linux, Solaris, FreeBSD, and Windows)

I've got all the platforms working except Windows and it revolves around the fact that I have the Hudson job executing a Python script via the shell. (i.e. In the Hudson job configuration under the "Build" section I have "Execute Shell" => "Command" => python ./build_project.py)

[win32] $ /bin/sh -xe C:\Users\build\AppData\Local\Temp\hudson3063181706777016948.sh
The system cannot find the path specified
FATAL: command execution failed

Is there a way, outside of creating another job to run just the Windows build, to have Hudson execute the build_project script as Shell for the Unix type OSes and execute it as a 开发者_StackOverflowbatch file when the target is a Windows slave?


Another option is to use the python plugin: http://wiki.hudson-ci.org/display/HUDSON/Python+Plugin

With this you simply specify the python file that should be executed.


I recommend installing Cygwin on your windows boxes so that they can run UNIX shell scripts. That's what we do and it works very well.


Create an ant script, build.xml in your workspace that contains:

<target name="default">
    <exec executable="python">
        <arg value="./build_project.py"/>
    </exec>
</target>

Then in Hudson, instead of the "Execute Shell" do a "Invoke Ant" instead. Make the target "default" (no quotes). You'll have to install/point to ant in your Hudson->Manage Hudson->Configure System->Ant section(not in the job, in the main Hudson config) but it should work.

0

精彩评论

暂无评论...
验证码 换一张
取 消