Hudson build notes txt file windows

September 24, 2010

I had a need to write a .txt file with build details for every build (windows). This involves using environmental variables and executing a windows batch command.

Create c:\buildinfo.bat

@echo off
echo Build number: %1
echo BUILD_ID: %2
echo JOB_NAME: %3
echo build_tag: %4
echo BUILD_URL: %5
echo WORKSPACE: %6

In your hudson job configuration select “Execute windows batch commmand” and then input the following:

c:\buildinfo.bat %BUILD_NUMBER% %BUILD_ID% %JOB_NAME% %BUILD_TAG% %BUILD_URL% %WORKSPACE% > c:\buildinfo.txt

Of course you will need to use robocopy or something to copy that in to your workspace or you could add:

copy c:\buildinfo.txt %workspace%