Search code examples
cruisecontrol.netccnet-config

Examples of modificationReader task in CC.Net?


I am trying to set up a build chain that propagates a modification history through the various build stages. My first thought was modificationWriter/modificationReader pairs, but I am having trouble getting the reader to read the results. Does anybody have any examples or tips?

I am using the latest CC.NET 1.4.4 SP1. Thanks!


Solution

  • Got it after some playing.

    Note that you need a recent version of CC.NET, I think version 1.4.3 or newer. This is from 1.4.4 SP1.

    I had first tried on 1.4.0 but the ModificationReader task doesn't exist in older versions.

    <cruisecontrol>
    
      <!--WATCH SANDBOX CONTINUOUS IS A TRIGGER TO CONTINUOUS BUILD AND INDIRECTLY FULL BUILD -->
      <project name="WatchSandboxContinuous" queue="TestQ" queuePriority="4">
        <triggers>
          <intervalTrigger/>
        </triggers>
        <sourcecontrol type="your_source_control_type">
          ...
        </sourcecontrol>
        <tasks>
          <modificationWriter>
            <filename>mods.xml</filename>
            <path></path>
            <appendTimeStamp>True</appendTimeStamp>
          </modificationWriter>
          <nullTask />
        </tasks>
      </project>
    
      <!--BUILD SANDBOX CONTINUOUS WOULD DO A FAST CONTINUOUS BUILD AND TRIGGER FULL BUILD -->
      <project name="BuildSandboxContinuous" queue="TestQ" queuePriority="3">
        <triggers>
          <projectTrigger project="WatchSandboxContinuous" />
        </triggers>
        <prebuild>
          <modificationReader>
            <filename>mods.xml</filename>
            <path>C:\Program Files\CruiseControl.NET\server\WatchSandboxContinuous\Artifacts</path>
            <deleteAfterRead>True</deleteAfterRead>
          </modificationReader>
        </prebuild>
        <tasks>
          <!--Propagate modification history to next full build-->
          <modificationWriter>
            <filename>mods.xml</filename>
            <path></path>
            <appendTimeStamp>True</appendTimeStamp>
          </modificationWriter>
          <nullTask />
        </tasks>
      </project>
    
      <!--BUILD SANDBOX FULL WOULD DO A FULL REBUILD AT NIGHT WITH ANY ADDITIONAL TASKS -->
          <project name="BuildSandboxFull" queue="TestQ" queuePriority="2">
            <triggers>
              <multiTrigger operator="And">
                <triggers>
                  <projectTrigger project="BuildSandboxContinuous" />
                  <scheduleTrigger buildCondition="ForceBuild" time="23:00" />
                </triggers>
              </multiTrigger>
            </triggers>
            <prebuild>
              <modificationReader>
                <filename>mods.xml</filename>
                <path>C:\Program Files\CruiseControl.NET\server\BuildSandboxContinuous\Artifacts</path>
                <deleteAfterRead>True</deleteAfterRead>
              </modificationReader>
            </prebuild>
            <tasks>
              <nullTask />
            </tasks>
    
          </project>
    
        </cruisecontrol>