Reputation: 826
I have a new TFS build (on premises) that gets all of the code every time it runs. I have Clean set to false both at the Get Sources and the build step. I'm pretty sure that this wasn't happening about a week ago when I first started using TFS2017 Build, but now every build re-gets the code. What am I missing?
Upvotes: 1
Views: 381
Reputation: 886
My problem was that I mapped a Folder and its Subfolder at the same time, but didn't realize that. Removing the Subfolder mapping then resolves the issue.
This is how I found out:
system.debug
set to true
Look at the log while building and spot something like (** **
) this:
**Attempting to find a workspace: 'ws_4_56'**
Skipping workspace: 'ws_1_56'
Skipping workspace: 'ws_2_55'
Skipping workspace: 'ws_3_56'
Candidate workspace: 'ws_4_56'
**Expected number of mappings: '57'. Actual: '56'**
Skipping workspace: 'ws_5_56'
Skipping workspace: 'ws_6_56'
**Matching workspace not found.**
If you have an expected mappings number higher than actual, then you have to check which mapping is redundant by comparing the agent output at <Workspace computer="xxxxx" islocal="true" name="ws_4_56" ...>
with the mappings in the TFS UI.
Upvotes: 1
Reputation: 302
Set Build.RepoClean to false in the Variables section. Seems to do the trick
Upvotes: 0
Reputation: 51093
Suggest your compare the build log for some build runs, check if there are using the same workspace on the build agent.
If there are multiple workspaces, you may using multiple build agents. Cleaning is not relevant if you are getting a new agent every time. You could specify a vNext build agent in the build definition and then queue multiple times for test.
Also try to explicitly define the Build.Clean
variable and set its value to below on the Variables tab:
all
if you want to delete $(Agent.BuildDirectory)
, which is the
entire working folder that contains the sources folder, binaries
folder, artifact folder, and so on.source
if you want to delete $(Build.SourcesDirectory)
.binary
If you want to delete $(Build.BinariesDirectory)
.Another way to narrow down the issue is remote to the build agent, check the files under the C:\TFS2017_agent\_work\3\S\XX
are deleted or not during the build process.
If all above is not working, try to recreate a build definition with same setting which may do the trick.
Upvotes: 0