0

I have some problem: Have a build with n steps. Last step is a custom c# notifier, that sends emails about build state. Now I need to receive artifacts and attach them to my email. The problem is that at last step we don't have already zipped artifacts, that's why we need to find them ourselves and zip. In some configurations I don't have any property "checkout directory". So, how I can get root checkout folder and artifact path?

ArgorAvest
  • 151
  • 1
  • 1
  • 11

1 Answers1

0

In order to attach files to your email I don't think you need to be using the REST API, but inbuilt parameters to find out various paths and locations. Without fully understanding your build pipeline I can only have a guess that this is what you need to know.

In built parameters

TeamCity offers a number of parameters that will help you with various paths

  • %teamcity.agent.work.dir% - This is the working directory of the agent
  • %teamcity.build.checkoutDir% - This is the checkout directory of the agent
  • %system.teamcity.build.tempDir% - This is the temporary build directory

Outputting these as part of a simple build, mine are:

enter image description here

Looking in the build log will help you work out where various bits are going. Again without fully appreciating your build setup I can only generalise, but here we can see that a .nupkg is being produced in the checkout directory.

enter image description here

TeamCity won't publish artifacts until after the last build step has executed in a build configuration, unless you want to force this using ##teamcity[publishArtifacts '<path>'], but I don't think that will help you unless you are trying to then call the REST API to get to the artifacts.

Hope this helps.

Matt
  • 3,684
  • 1
  • 17
  • 19
  • the main problem for me now is finding %teamcity.build.checkoutDir% for running build. I try to use `http://teamcity:8111/httpAuth/app/rest/builds/id:/resulting-properties` according to REST API service, but I can see checkout dir only for finished build. I think, that somewhere need to be all properties of build, avoiding log parsing – ArgorAvest Aug 17 '16 at 12:22
  • well, my final build step tries to read properties of build. If build fails, notifier found changes and send email to author, that he failed build with his last commit. However, we need to extend this program to send artifacts. Artifact files I can find, if I will know checkout dir and parse artifact rules. Now I cannot get checkout dir for running build. – ArgorAvest Aug 17 '16 at 12:41
  • %teamcity.build.chec‌​koutDir% is the checkout directory for the running build – Matt Aug 17 '16 at 12:54