Perforce streams switch workspace

Hi,

we have a set-up where we call the RESTI API from TeamCity to trigger a build of the project from a specific Perforce stream.

The VCS Perforce Stream is setup like this: “//%StreamDepot%/%StreamName%”.

In the environment variables we set the StreamDepotand StreamName and TeamCity correctly picks that up and checks out the workspace on the client.

Unfortunately using the same workspace directory (e.g. “C:\Build\Project\”) will make TeamCity to always delete the workspace and do a full checkout again, instead of only switching the stream and run p4 -clean to make sure there's no conflicts when switching.

This is how the log looks like:

Using vcs information from agent file: 13c4b00a_CustomBuild.xml
11:09:33 Full checkout enforced. Reason: [VCS settings have been changed]
11:09:33 Will perform clean checkout. Reason: VCS settings have been changed
11:09:33 Checkout directory: C:\Build\Project
Updating sources: agent side checkout
11:09:33   VCS Root: Streams_Parameterised_Root
11:09:33     revision: 738150
11:09:34     Will use p4 executable from 'p4' for VCS Root 'Streams_Parameterised_Root'
11:09:34     Clean checkout requested, will delete P4 workspaces for the build
11:09:34     Deleting workspace TC_p4_bnetcba06_CustomBuild_3a6656002b73f5d0 to ensure clean checkout
11:09:34     Updating sources for root 'Streams_Parameterised_Root', revision/label: @738150
11:09:34       Creating P4 workspace TC_p4_bnetcba06_CustomBuild_3a6656002b73f5d0
11:09:35       Running 'p4 sync -f' in directory C:\Build\Project

On solution is obviously to have a separate workspace for every stream (e.g. “C:\Build\Project\%teamcity.build.branch%\”), however that pollutes the build server with many (even old unused) workspaces, which is quite a lot of data (since our project will accumulate around 30GB per workspace after it has been built).

 

Is there any way to implement a Perforce p4 -clean and switch streams instead of resetting the workspace?

 

2

Please sign in to leave a comment.