thoughtworks cruise - How to set label prefix application version with CruiseControl.NET -


we're using cruise control v1.8.5. have next scenario:

  • checkout source code git repository
  • run scripts build project (e.g. npm install && cordova clean, cordova build, minify css files, compile typescript ...)

now want add label on successfull build. therefore found cruisecontrol has labeller option, added:

<cb:define name="mylabeller">     <labeller type="defaultlabeller">         <initialbuildlabel>1</initialbuildlabel>         <labelformat>0</labelformat>         <incrementonfailure>true</incrementonfailure>         <labelprefixfile>x:\buildfiles\myproject\version.txt</labelprefixfile>         <labelprefixfilesearchpattern>\d\.\d\.\d\.</labelprefixfilesearchpattern>     </labeller> </cb:define> 

but problem that, done before source code retrieved (git) repository. read version project , cruisecontrol regex reads version , outputs like: 1.0.3.buildnumber.

how set/update label prefix version after retrieving source code repository. reads old one, before checkout. read dynamic variables, can somehow set or something?

appending project's xml:

<cb:scope projdirname="myproject">         <project name="myproject" queue="daily" queuepriority="30">             <workingdirectory>d:\buildfiles\$(projdirname)\working</workingdirectory>             <artifactdirectory>d:\buildfiles\$(projdirname)\artifacts</artifactdirectory>            <cb:sourcecontrol module="modul1"  tagonsuccess="false" branch="$(branchdevelop)" />             <tasks>                        <cb:npminstall />               <cb:build />             </tasks>             <cb:mylabeller />             <cb:commonall />                         </project>     </cb:scope> 

figured cruisecontrol sets next build version when project build started , before project's xml read (checkout, tasks, ...).

cruisecontrol project build log:

<parameters> <parameter name="$ccnetartifactdirectory" value="d:\buildfiles\myproject\artifacts" /> <parameter name="$ccnetbuildcondition" value="forcebuild" /> <parameter name="$ccnetbuilddate" value="2016-01-25" /> <parameter name="$ccnetbuildid" value="9d8234720e7342a3aa636aacc120eb13" /> <parameter name="$ccnetbuildtime" value="13:49:42" /> <parameter name="$ccnetfailuretasks" value="system.collections.arraylist" /> <parameter name="$ccnetfailureusers" value="system.collections.arraylist" /> <parameter name="$ccnetintegrationstatus" value="unknown" /> <parameter name="$ccnetlabel" value="1.0.88" /> <parameter name="$ccnetlastintegrationstatus" value="failure" /> <parameter name="$ccnetlistenerfile" value="d:\buildfiles\myproject\artifacts\myproject_listenfile.xml" /> <parameter name="$ccnetmodifyingusers" value="system.collections.arraylist" /> <parameter name="$ccnetnumericlabel" value="88" /> <parameter name="$ccnetproject" value="myproject" /> <parameter name="$ccnetprojecturl" value="http://builder/ccnet" /> <parameter name="$ccnetrequestsource" value="machinename1" /> <parameter name="$ccnetuser" value="user1" /> <parameter name="$ccnetworkingdirectory" value="d:\buildfiles\myproject\working" /> <parameter name="$lastchangenumber" value="96ece86d55f83c8eb129cbfeb01724a3d37bb18a" /> 

also makes sense continuous integration dictates application version e.g. major.minor.build instead each commit dictates version.

solution:

    <cb:scope projdirname="myproject">         <project name="myproject" queue="daily" queuepriority="30">             <workingdirectory>d:\buildfiles\$(projdirname)\working</workingdirectory>             <artifactdirectory>d:\buildfiles\$(projdirname)\artifacts</artifactdirectory>             <cb:sourcecontrolmyproject branch="develop"/>             <cb:dailytrigger />             <tasks>               <cb:npminstall />               <cb:buildrelease />               <cb:publishafter />             </tasks>             <publishers>                 <cb:commonpublish/>             </publishers>              <cb:mylabeller labelprefix="1.0." /> <!-- version fixed -->             <cb:commonall />              </project>     </cb:scope> 

and labeller:

<cb:define name="mylabeller">     <labeller type="defaultlabeller">     <initialbuildlabel>1</initialbuildlabel>     <prefix>$(labelprefix)</prefix>     <incrementonfailure>true</incrementonfailure>     <labelformat>0</labelformat>   </labeller> </cb:define> 

currently setup ok. in case we'll developing version 1.1 upper setup must changed. main point versioning working e.g. 1.0. + cruisecontrol_next_build_number.


Comments

Popular posts from this blog

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -