tfsazure-devopsazure-pipelinesgated-checkin

Getting only partial Shelveset in vNext Build


I'm facing the following issue. We have a Gated Check-In setup which means changes are not directly checked-in, but a Shelveset is created and a build is run against that shelve. Only if the build is successful, the changes are checked in.

Now we setup the build definition to only map as few things as needed to build, as we want to keep the time it needs to run at a very minimum. The problem now is that if you include in your change anything that is not mapped, the build will fail in the GetSources task, as it fails to unshelve and gives a folder mapping error.

For a better understnanding, imagine the following structure:
- MyRepository
-- Sources
--- MyCodeFiles
-- Documents
--- SomeDocuments

So in the BuildDefinition we only map the Sources directory, as this contains the files we need to build. You now have to make sure to never include any change outside of Sources, for example within Documents, otherwise the Build will immediately fail.

I already searched and found the description of the unshelve command: https://learn.microsoft.com/en-us/vsts/tfvc/unshelve-command?view=vsts

According to this description it should be possible to specifiy the itemSpec that

Identifies the file or folder revisions to unshelve into the current workspace

So it seemes like the unshelve command would actually support to "partially" unshelve. However I did not see any way on how to achieve that with a vNext build, as I could not find any infos on how the GetSources task is working.

Is there something I missed or is this with the current implementation simply not possible to achieve?


Solution

  • I'm afraid to say you haven't missed anything, it's just not possible in the current implementation. There is a more detailed discussion here:

    https://github.com/Microsoft/vsts-agent/issues/1087