Question

I have a CruiseControl project that executes a file build.py, whether it is nightly or CI. I would like to throw up some kind of flag in my build script that can determine which function to call, so I don't have to have two .py files that do essentially the same thing.

Is it possible to pass in variables or parameters through CruiseControl when executing a .py file?

<project name="x" default="build">
<target name="build-ci">
    <exec executable="python" failonerror="true">
        <arg value="build-cc.py" />
        <arg value="$(label)" />
    </exec>
</target>

<project name="x-nightly" default="build">
    <target name="build-nightly">
        <exec executable="python" failonerror="true">
            <arg value="build-cc.py" />
            <arg value="$(label)" />
        </exec>
    </target>
</project>
Was it helpful?

Solution

You can pass properties into ant from cruisecontrol. build-type will be a property in your ant script.

<schedule interval="${schedule_interval.seconds}">
    <ant anthome="${anthome.dir}" buildfile="${buildfiles.dir}${antbuild.file}" target="my-ant-target" uselogger="true">
        <property name="build-type" value="nightly"/>               
    </ant>
</schedule>

So if you have two cruisecontrol projects, one for the nightly and one for the CI, they could each pass in a different value for build-type.

Your question is hard to understand for me though. Could you post some of your cruisecontrol script?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top