Monday, June 9, 2014

Beware the Windows Scheduled Tasks!

I've had a TeamCity server run much much slower than it's other counterparts.

I finally narrowed it down to Scheduled Tasks. The agent was started at logon by Scheduled Tasks.

It looks like Scheduled Tasks will start in under below normal priority and while this wasn't a problem for many of our build tools, TortoiseSVN however performs very very poorly in below normal priority.

Simple Hall and Teamcity Integration

You will have to set up these 2 parameters as environment variables to be passed in your TeamCity project parameters configuration.

env.BuildID = %teamcity.build.id%
env.BuildTypeID = %system.teamcity.buildType.id%

Checks to see if it's running under TeamCity and then sends the INFO

if not "%TEAMCITY_PROJECT_NAME%" == "" curl -X POST -H "Content-Type: application/json" -d "{\"title\":\"TeamCity\",\"message\":\"Failed - %TEAMCITY_PROJECT_NAME% - %TEAMCITY_BUILDCONF_NAME% - %BUILD_NUMBER% ^<a href="http://TEAMCITYURL/viewLog.html?buildId=%BuildID%&buildTypeId=%BuildTypeID%&tab=buildResultsDiv"^>View Build^</a^>\",\"picture\":\"http:/TEAMCITYURL/img/icons/TeamCity32.png\"}" https://hall.com/api/1/services/generic/HALLID

Thursday, June 5, 2014

Visual Studio Property files and line endings

If you like to lay out multi line preprocessor definition in macros in .props files.

<pc32_preprocessor>
      WF_PC32;
      WIN32;
      _CRT_SECURE_NO_WARNINGS;
      $(FORCED_ENVARS)
</pc32_preprocessor>

Something like that. Certain plugins like the clang plugin will cause all sorts of interesting errors because it'll pass the command line to the compiler with the CRLF.

Change line endings to Old Mac format CR only.

VS will allow you to edit and it will respect the line endings and wont convert it, and it seems to pass through to the compiler just fine.

Integrating windows hosted SVN with hall, logs and diffs provided with WEBSVN

For posterity

SET PATH=%PATH%;E:\svn;E:\curl\bin;E:\bin

SET REPOS="%1"
SET REV=%2

SET HALLROOM=put Group API Token here
SET WEBSVNHOST=https://YOUR_URL_HERE/revision.php?repname=REPONAME
SET PATHTOMATCH=trunk

REM HALL INTEGRATION

svnlook author %REPOS% --revision %REV%> E:\temp\svnlook%REV%_USER
SET /P SVN_USERNAME=<E:\temp\svnlook%REV%_USER
del E:\temp\svnlook%REV%_USER

svnlook log %REPOS% --revision %REV%> E:\temp\svnlook%REV%_LOG
SET /P SVN_COMMIT_MESSAGE=<E:\temp\svnlook%REV%_LOG
del E:\temp\svnlook%REV%_LOG

svnlook dirs-changed %REPOS% --revision %REV%> E:\temp\svnlook%REV%_CHANGED
SET /P SVN_COMMIT_DIRECTORY=<E:\temp\svnlook%REV%_CHANGED

SET SVNMESSAGE=Revision : %REV% - %SVN_USERNAME% - %SVN_COMMIT_MESSAGE%

grep -E "%PATHTOMATCH%" E:\temp\svnlook%REV%_CHANGED
if "%ERRORLEVEL%"=="0" curl -X POST -H "Content-Type: application/json" -d "{\"title\":\"SVN Commit\",\"message\":\"%SVNMESSAGE%^<br^> ^<a href="%WEBSVNHOST%&path=%%2F&rev=%REV%"^>Inspect Log^</a^>\"}" https://hall.com/api/1/services/generic/%HALLROOM%

del E:\temp\svnlook%REV%_CHANGED