Monthly Archives: December 2013

Formatted Date Parameter – A Plugin for TeamCity

I’ve been using TeamCity for a short while now at my new job. it seemed like there’s nothing it can’t do for me.

I decided I want to get a timestamp generated and incorporated into the build number. However, that seemed a bit more difficult than i thought.

A quick search shows a couple of options:

  • Date Build Number Plugin
    • It sets the entire build number to the timestamp, so you can’t put anything else there, like the VCS revision, build counter or Maven version number.
    • Installation is kinda funky, having to dilddle with TC configuration files.
  • Groovy Plug
    • This plugin provides the build start timestamp as a parameter, which is great
    • The timestamp format isn’t easily configurable
    • Installation is again non-standard
    • The plugin notes say it’s a bit of a memory hog, and it was meant as a demo anyway

So I just wrote my own.

Formatted Date Parameter provides a confguration parameter (named build.formatted.timestamp), which during build will contain the build start timestamp. The timestamp format is ISO-1806 by default (“yyyy-MM-dd’T’HH:mmZ”). The timestamp format can be configured using another configuration parameter (named build.timestamp.format), which uses standard SimpleDateFormat syntax.

Installation:

Just like the guide says

  • Copy the zip (see link at bottom of page) to the .BuildServer/plugins dir (for me it was /home/username/.BuildServer/plugins)
  • Restart the Tomcat instance your TeamCity WAR is deployed to.

 

Usage:

In my case, I wanted the week-in-year (01-52) to appear in the build number, so I

  1. Added build.formatted.timestamp to the build number format field (build configuration -> general settings page)
    using the %build.formatted.timestamp% parameter in the build number field
    using the %build.formatted.timestamp% parameter in the build number field

     

  2. Then I set the value of build.timestamp.format to show only the week number in 2 digits “ww” (build configuration -> build parameters page -> Add configuration parameter button)
    Setting the timestamp format
    Setting the timestamp format

     

  3. Now my build number contains the current week number. Hurray.

 

 

FormattedDateParameter v1.1 plugin for TeamCity (download) (source on github)

My top 10 JavaOne 2013 talks

javaone

JavaOne 2013 was pretty cool and the sessions just became available online.

Here are my top 10 sessions:

  1. Jim Manico – Top 10 Web Application Defenses for Java Developers
  2. Matt Raible – The Modern Java Web Developer
  3. Kevin Nilson – Seeing Through the Clouds
  4. Ian Robertson – The Science and Art of Backward Compatibility
  5. Nicolas De Loof – Cloud Patterns
  6. Peter Hendriks – Practices and Tools for Building Better APIs
  7. Simon Maple – The Adventurous Developer’s Guide to Application Servers
  8. Ram Lakshmanan – Seven Secrets of Wells Fargo SOA Platform’s 99.99 Percent Availability
  9. Nikita Salnikov-Tarnovski – I Bet You Have a Memory Leak in Your Application
  10. Simon Maple – The Adventurous Developer’s Guide to JVM Languages