Artifact Paths does not use updated Environment Variable

We need to use a custom build format that team city does not support so i got around this by using the service messages in a powershell script to update the build number

http://confluence.jetbrains.com/display/TCD7/Build+Script+Interaction+with+TeamCity

I set my build number to

1.{MONTH}.{DAY}.{0}

And the powershell script replaces the month and day with the date of the build. here is the script

$version = $Env:build_number $version = $version -replace "{DAY}",(Get-Date -format "dd") $version = $version -replace "{MONTH}",(Get-Date -format "MM") "##teamcity[message text='The build number will be $version' status='NORMAL']" "##teamcity[buildNumber '$version']"



Theis works and upades the buildnumber, i can see it in the parameter results. The problem though is i also need to package the result of a build into a zip that contains the build number but the zip end up as "1.{MONTH}.{DAY}.23.zip" instead on the version that is set in the powershell script.
The artifact paths i am using is

.\bin\Release\*.* => %env.BUILD_NUMBER%.zip


I've aslo tried setting the env and sys variables in the powershell script

"##teamcity[env.BUILD_NUMBER '$version']" "##teamcity[setParameter name='env.build.number' value='$version']" "##teamcity[setParameter name='system.build.number' value='$version']"



and using the %build.number% and %system.build.number% variables in the artifact paths. Nothing seems to work.

am i missing something??
2 comments
Comment actions Permalink

Hello Ryan,

This is a know issue: http://youtrack.jetbrains.com/issue/TW-18455 please, watch/vote for it.

As a workaround, may I suggest you to publish your artifact using service message ? Here is the message, that will start publishing your artifact:

##teamcity[publishArtifacts '.\bin\Release\*.* => $version.zip']
0
Comment actions Permalink

Thanks for the work around. I ended up writing a console app to do the zipping and called it via a powershell script. then i just added any zip fles in a set location. Its not a elegant as this work around though becuase the code to ensure the error result of the console app bubbles up to team city is about 10 lines long.  

0

Please sign in to leave a comment.