Reputation: 21
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.
Upvotes: 1
Views: 849
Reputation: 33708
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.
Upvotes: 2
Reputation: 59037
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.
Upvotes: 3