0
  • I have now a custom build task extension that I created.
  • I added the build task to my build definition.
  • In the build task I create some result file.
  • How can I add that file as a test result in the current build.
  • Is there API, to upload a file, get current account name, and needed authentication information, get current build number, project name, etc

I'm totally new to VSTS and online resources doesn't help much from where should I start.

Community
  • 1
  • 1

1 Answers1

0

The REST API in VSTS supports updating a build. You can use PAT (Personal Access Token) to authenticate with the VSTS REST API. But if you are running script with build to access REST API you can just enable "Allow Scripts to Access OAuth Token" You can use PowerShell and invoke a request to update many things in VSTS using rest API (use PowerShell Invoke-RestMethod). To get the current build number etc. within a build you can use build variables as shown below.

$collectionUri = $Env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI
$TeamProject = $Env:SYSTEM_TEAMPROJECT
$BuildName = $Env:BUILD_DEFINITIONNAME
$BuildId = $Env:BUILD_BUILDID
$BuildNumber = $Env:BUILD_BUILDNUMBER
ChamindaC
  • 1,452
  • 10
  • 10