GIT - Get CruiseControl NET to Push to Origin

406 views Asked by At

I have go CruiseControl.NET successfully building my solution. Before it builds, it increments the version number in a shared "assemblyinfo.cs" - I wrote a custom command-line util to do this.

My project is setup as follows:

<sourcecontrol type="git">
    <repository>[email protected]:repo.git</repository>
    <branch>develop</branch>
    <autoGetSource>true</autoGetSource>
    <fetchSubmodules>true</fetchSubmodules>
    <tagOnSuccess>true</tagOnSuccess>
    <commitBuildModifications>true</commitBuildModifications>
    <commitUntrackedFiles>false</commitUntrackedFiles>
    <tagCommitMessage>Auto Build {0}</tagCommitMessage>
    <tagNameFormat>Auto-Build-{0}</tagNameFormat>
    <committerName>Build Server</committerName>
    <committerEMail>[email protected]</committerEMail>
    <workingDirectory>C:\Scratch\repo</workingDirectory>
    <timeout units="hours">2</timeout>
</sourcecontrol>

<tasks>
  <exec>
    <!-- Custom version incrementor -->
    <executable>C:\Program Files (x86)\CruiseControl.NET\VersionIncrementor.exe</executable>
    <buildArgs>C:\Scratch\repo\SharedAssemblyInfo.cs</buildArgs>
    <description>Increment Version</description>
  </exec>

  <devenv>
    <solutionfile>C:\Scratch\repo\test.sln</solutionfile>
    <configuration>Debug</configuration>
    <executable>C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\devenv.com</executable>
  </devenv>

</tasks>

<publishers>
  <xmllogger />
  <artifactcleanup cleanUpMethod="KeepLastXBuilds"
                   cleanUpValue="10" />
</publishers>

So far, it is commit the incremented version locally, but how do I get it to push that commit to origin?

UPDATE

My changes are getting committed, they just aren't getting pushed. When I open up the repo on the build machine in SourceTree see that it is "detached from origin/develop", I also see that the version is getting incremented and the commit is getting tagged, but the commit is not in my branch.

enter image description here

1

There are 1 answers

2
Simon Laing On

You have commitBuildModifications and tagOnSuccess turned on, so any changes would be committed during the 'publish' of the build. There would be no need to change your configuration.

  1. The change would only be committed in the event of a successful build
  2. The change would be committed after the build, not before
  3. If any of the following tasks fail the change/increment would not be committed.

See the Tagging a successful build section http://cruisecontrolnet.org/projects/ccnet/wiki/Git