Question

I have created a variable in cruise control configuration file

I want to change the value of this variable in cruise control later during execution. Basically what I want is while executing task1, value of 'MyVariable' should be say 'val1' and while executing task2, value should be say 'val2'.

One more thing that I want is, there should be no manual interaction or manual assignment from ui, the value should be changed automatically.

Can anybody please help me in achieving this? Any suggestion/ inputs would be great help. Thanks in advance.

Was it helpful?

Solution

I'm using the following approach to compile one MSBuild with different parameters (ccnet 1.8):

<cb:define name="Build">
  <msbuild>
     <some_parameter>$(MyVariable)</some_parameter>
     <other_parameter>parameter_value</other_parameter>
  </msbuild>
</cb:define>

and then in tasks section:

<cb:Build MyVariable="val1" />
<cb:Build MyVariable="val2" />

OTHER TIPS

If those values of MyVariable are constant (I mean always the same for given task) then I'd use preprocessor. Then you can override the value with cb:scope.

For example, here's what I do with projects configuration:

<cb:scope 
    Project.Name = "ProjectName - Feedback - Integration tests"
    Project.ShortName = "project-name-feedback-quick"
    Project.Category = "Project Name - Feedback"
    Project.Description =  "Run integration tests"
>

    <project name="$(Project.Name)" description="$(Project.Description)">               
        <artifactDirectory>$(CIRootFolderPath)\$(Project.ShortName)\Artifacts</artifactDirectory>
        <workingDirectory>$(CIRootFolderPath)\$(Project.ShortName)\WorkingDir</workingDirectory>
        <state type="state" directory="$(CIRootFolderPath)\$(Project.ShortName)" />

So you would surround each <task> with <cb:scope> block and redefine value of MyVariable in there.

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