TeamCity and calendar versioning










1














I recently got introduced to the concept of CalVer. I thought I'd play with the concept on a little test build, to see if I could get a meta-runner extracted to be used for other builds, should we decide to take this forward.



I'm looking to:



  • Have a build step that runs on Linux and Windows agents

  • Have a build number in the format: YY.MM.BC (2 digit year, 2 digit month and the build counter).

  • Have the build counter reflect the number of builds in a given month

I'm happy to play with the format more as time goes on.



I have the first parts done. To make this compatible with both our linux and Windows build agents, I've leveraged the Docker support and run the script in this step in an alpine container. It only adds on 1 second and makes it cross-platform. I then use a script like this to update the build number to a CalVer looking build.



date_portion=$(date +"%%y.%%m")
build_number=$BUILD_NUMBER
combined="$date_portion.$build_number"
echo "##teamcity[buildNumber '$combined']"


Results in build numbers like: 18.11.1



My question is: How would I go about making it so that builds I do in December have a build counter starting off at 1? I'd rather not have to run a build once a month to reset it if I can help it. Are there any cleaner ways?










share|improve this question


























    1














    I recently got introduced to the concept of CalVer. I thought I'd play with the concept on a little test build, to see if I could get a meta-runner extracted to be used for other builds, should we decide to take this forward.



    I'm looking to:



    • Have a build step that runs on Linux and Windows agents

    • Have a build number in the format: YY.MM.BC (2 digit year, 2 digit month and the build counter).

    • Have the build counter reflect the number of builds in a given month

    I'm happy to play with the format more as time goes on.



    I have the first parts done. To make this compatible with both our linux and Windows build agents, I've leveraged the Docker support and run the script in this step in an alpine container. It only adds on 1 second and makes it cross-platform. I then use a script like this to update the build number to a CalVer looking build.



    date_portion=$(date +"%%y.%%m")
    build_number=$BUILD_NUMBER
    combined="$date_portion.$build_number"
    echo "##teamcity[buildNumber '$combined']"


    Results in build numbers like: 18.11.1



    My question is: How would I go about making it so that builds I do in December have a build counter starting off at 1? I'd rather not have to run a build once a month to reset it if I can help it. Are there any cleaner ways?










    share|improve this question
























      1












      1








      1







      I recently got introduced to the concept of CalVer. I thought I'd play with the concept on a little test build, to see if I could get a meta-runner extracted to be used for other builds, should we decide to take this forward.



      I'm looking to:



      • Have a build step that runs on Linux and Windows agents

      • Have a build number in the format: YY.MM.BC (2 digit year, 2 digit month and the build counter).

      • Have the build counter reflect the number of builds in a given month

      I'm happy to play with the format more as time goes on.



      I have the first parts done. To make this compatible with both our linux and Windows build agents, I've leveraged the Docker support and run the script in this step in an alpine container. It only adds on 1 second and makes it cross-platform. I then use a script like this to update the build number to a CalVer looking build.



      date_portion=$(date +"%%y.%%m")
      build_number=$BUILD_NUMBER
      combined="$date_portion.$build_number"
      echo "##teamcity[buildNumber '$combined']"


      Results in build numbers like: 18.11.1



      My question is: How would I go about making it so that builds I do in December have a build counter starting off at 1? I'd rather not have to run a build once a month to reset it if I can help it. Are there any cleaner ways?










      share|improve this question













      I recently got introduced to the concept of CalVer. I thought I'd play with the concept on a little test build, to see if I could get a meta-runner extracted to be used for other builds, should we decide to take this forward.



      I'm looking to:



      • Have a build step that runs on Linux and Windows agents

      • Have a build number in the format: YY.MM.BC (2 digit year, 2 digit month and the build counter).

      • Have the build counter reflect the number of builds in a given month

      I'm happy to play with the format more as time goes on.



      I have the first parts done. To make this compatible with both our linux and Windows build agents, I've leveraged the Docker support and run the script in this step in an alpine container. It only adds on 1 second and makes it cross-platform. I then use a script like this to update the build number to a CalVer looking build.



      date_portion=$(date +"%%y.%%m")
      build_number=$BUILD_NUMBER
      combined="$date_portion.$build_number"
      echo "##teamcity[buildNumber '$combined']"


      Results in build numbers like: 18.11.1



      My question is: How would I go about making it so that builds I do in December have a build counter starting off at 1? I'd rather not have to run a build once a month to reset it if I can help it. Are there any cleaner ways?







      teamcity






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 12 at 14:06









      Craig Brett

      1,7211522




      1,7211522



























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53263844%2fteamcity-and-calendar-versioning%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53263844%2fteamcity-and-calendar-versioning%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          這個網誌中的熱門文章

          How to read a connectionString WITH PROVIDER in .NET Core?

          Museum of Modern and Contemporary Art of Trento and Rovereto

          In R, how to develop a multiplot heatmap.2 figure showing key labels successfully