Teamcity REST API: get an artifact path

吃可爱长大的小学妹 提交于 2019-12-25 09:09:12

问题


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?


回答1:


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:

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.

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.



来源:https://stackoverflow.com/questions/38994650/teamcity-rest-api-get-an-artifact-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!