Login or Sign Up to become a member!
LessThanDot Sit Logo

LessThanDot

Desktop Developer

Less Than Dot is a community of passionate IT professionals and enthusiasts dedicated to sharing technical knowledge, experience, and assistance. Inside you will find reference materials, interesting technical discussions, and expert tips and commentary. Once you register for an account you will have immediate access to the forums and all past articles and commentaries.

LTD Social Sitings

Lessthandot twitter Lessthandot Linkedin Lessthandot friendfeed Lessthandot facebook Lessthandot rss

Note: Watch for social icons on posts by your favorite authors to follow their postings on these and other social sites.

Your profile

    Search

    XML Feeds

    Google Ads

    « Android and barcode scanningThe EndlessLoopQueue »
    comments

    The always amazing Paul Stack has released his very first edition of teamcitysharp and I though it a good idea to try it.

    If you don't know what teamcity is then you are missing out. No need to hold back either since it is free for personal use and some other uses.

    For people that use Teamcity it is always useful if you can spread your stats around and show the managers what you are doing and how good you are doing. Managers love shiny things. So I made this shiny thing in less then ten minutes so the managers can now see how well I'm doing.

    You would also like to keep it simple for your manager.

    My statusboard looks like this.

    And yes I made that just now in less than ten minutes.

    Here is how I connected tot the teamcity server

    1. var client = new TeamCityClient("url:port");
    2. client.Connect("username", "password");

    the url is the url to the server but without the http:// in front of it.

    This is how I got all the information you see in that status.

    1. var projects = client.AllProjects();
    2. RtfUtils.RtfRedSizeplus3(Text, "Builds");
    3. foreach(var project in projects)
    4. {
    5.   RtfUtils.RtfBlackBold(Text, project.Name);
    6.   foreach(var config in client.BuildConfigsByProjectId(project.Id))
    7.   {
    8.     var lastBuild = client.LastBuildByBuildConfigId(config.Id);
    9.     RtfUtils.RtfBlackNormal(Text, config.Name);
    10.     if (lastBuild.Status == "SUCCESS")
    11.     {
    12.       RtfUtils.RtfGreenNormal(Text, " last built on " + DateTime.ParseExact(lastBuild.StartDate, "yyyyMMddTHHmmsszzzzz", System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy HH:mm"));  
    13.     }
    14.     else
    15.     {
    16.       RtfUtils.RtfRedNormal(Text, " last built on " + DateTime.ParseExact(lastBuild.StartDate, "yyyyMMddTHHmmsszzzzz", System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy HH:mm"));  
    17.     }
    18.   }
    19.   RtfUtils.RtfBlackBold(Text, "");
    20. }

    The important things are the client.AllProjects() which gets you all the projects. The client.BuildConfigsByProjectId(project.Id) which gets you all the Buildconfigsfor that project. And client.LastBuildByBuildConfigId(config.Id) which will get you the latest build information of that build. On success I then color the text green and on failure I color it red.

    So there, simple enough.

    But remember this is version 0.1 so a few features are still missing. But I'm sure Paul will add them all over the weekend ;-).

    About the Author

    User bio imageChris is awesome.
    Social SitingsTwitterHomePageLTD RSS Feed
    InstapaperVote on HN

    1 comment

    Comment from: sybil2 [Member] Email
    sybil2 Love to see this little duck everywhere :P

    Very nice post help a lot with my barcode scanning and generation project.
    12/12/12 @ 19:54

    Leave a comment


    Your email address will not be revealed on this site.

    To mislead the spambots.

    Your URL will be displayed.
    (Line breaks become <br />)
    (Name, email & website)
    (Allow users to contact you through a message form (your email will not be revealed.)