Increment in _work directory

拟墨画扇 提交于 2019-12-11 10:08:33

问题


What causes the folder name under '_work' to change on a Private Agent?

We are currently using _work/10/s etc. It has used this for the last few builds, but what would cause it to step up to using /11?

I should say we are still in the early days of using VSTS, hence why there are so few builds.

I get the feeling that it is either that we didn't initially perform any cleaning of the work directory, we do now, or that it changes when we change the build definition. Both sound plausible.


回答1:


Each build definition gets its own folder. This allows for total isolation of source code and build outputs.

You should never rely on hard-coding this path; you can reference a build's working directory with the $(System.DefaultWorkingDirectory) variable.




回答2:


There is SourceRootMapping folder in the working folder and there are Mappings.json and SourceFolder.json files (SourceRootMapping{guid} folder{build definition id} folder\sourceFolder.json) in this folder.

Mappings.json:

{
  "lastBuildFolderCreatedOn": "05/16/2018 13:20:06 +08:00",
  "lastBuildFolderNumber": 2
}

A SourceFolder.json:

{
  "build_artifactstagingdirectory": "1\\a",
  "agent_builddirectory": "1",
  "collectionUrl": "https://XXX.visualstudio.com/",
  "definitionName": "a",
  "fileFormatVersion": 3,
  "lastRunOn": "05/16/2018 13:18:06 +08:00",
  "repositoryType": "TfsGit",
  "lastMaintenanceAttemptedOn": "",
  "lastMaintenanceCompletedOn": "",
  "build_sourcesdirectory": "1\\s",
  "common_testresultsdirectory": "1\\TestResults",
  "collectionId": "21136b22-dbe8-4fae-a111-3f8c5b0fed9b",
  "definitionId": "285",
  "hashKey": "d2545895fec8eea22c60ecc24f6593a986106b80",
  "repositoryUrl": "https://starain.visualstudio.com/Scrum2017/_git/cppbase",
  "system": "build"
}

So, it’s easy to find that the VSTS agent increase the folder number per to Mappings.json and SourceFolder.json file is used to mapping build definition and its corresponding working folder.



来源:https://stackoverflow.com/questions/50332848/increment-in-work-directory

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