Perforce Integration: Overriding P4CLIENT machine environment variables with agent checkout TC_p4 created workspace
Is there an option to override the P4CLIENT on build run to use the agent-side checkout TC_p4 created workspace and override the environment variable that is set in the machine-level. I need this only for a specific TC build for SonarQube integration, and all other builds should still use the machine-level default P4CLIENT workspace,
This is the issue I am getting:
[Updating sources] VCS Root: BuildTools Root (ant)
[11:51:32][VCS Root: BuildTools Root (ant)] revision: 1396738
[11:51:32][VCS Root: BuildTools Root (ant)] Will use p4 executable from 'p4' for VCS Root 'BuildTools Root (ant)'
[11:51:32][VCS Root: BuildTools Root (ant)] Clean checkout requested, will delete P4 workspaces for the build
[11:51:32][VCS Root: BuildTools Root (ant)] Updating sources for root 'BuildTools Root (ant)', revision/label: @1396738
[11:51:32][Updating sources for root 'BuildTools Root (ant)', revision/label: @1396738] Creating P4 workspace TC_p4_samplebuildserver_56daa6d6d0b20c13_c4a7a0b7a6e90dc7
[11:51:32][Updating sources for root 'BuildTools Root (ant)', revision/label: @1396738] Running 'p4 sync -f'
[11:51:32][VCS Root: BuildTools Root (ant)] Skip setting P4CLIENT environment variable to TC_p4_samplebuildserver_56daa6d6d0b20c13_c4a7a0b7a6e90dc7, already set to "samplebuildserver-ws"
Thanks,
Andro
Please sign in to leave a comment.
Hi Andro,
it should be possible to set the env.<variable> in the build configuration parameters. That would override the agent configuration as you can see here (env. variables on the agent process are last in the priority list): https://confluence.jetbrains.com/display/TCD10/Defining+and+Using+Build+Parameters+in+Build+Configuration#DefiningandUsingBuildParametersinBuildConfiguration-UsingBuildParametersintheBuildScripts
Thanks for the help Denis.
But, just to confirm for my understanding.
So doing this would mean, the P4CLEINT environment variable should be "cleared" out. And when the SCM step happens, the agent client side checkout would create the temporary "build" workspace. Which will be used and so the message I have above about skipping should go away.
https://confluence.jetbrains.com/display/TCD10/Perforce+Workspace+Handling+in+TeamCity#PerforceWorkspaceHandlinginTeamCity-PerforceWorkspaceParameters
Thanks!
Hi Andro,
As far as I'm understanding the issue, the P4CLIENT isn't being overwritten (according to the build log) by TeamCity during the VCS step because it finds it already set in the build process (a.k.a. your machine has it already set up, and the build agent is picking it up). By passing yourself a value for the variable overriding the already existing one, the build process should have the value you have passed to it. Clearing it might work (it should be unset for the build process and thus get modified properly), but fully overriding it with another value would be safer.
Hi Denis,
I have same issue but I can't find a place where I should override this value. On my machine there is another P4CLIENT defined and Team City uses this client instead of the Team City dedicated user's P4CLIENT . Where should I change it?