Access to perforce view while executing a given configuration

Hi,

Is there any way to access the P4 configuration and view used by an agent?
We have some ANT targets that requires this information and I don't find a solution.

Thanks

7 comments

Hello,

Why do you need this information? Currently build agents do not use p4 settings at all, because checkout is done on the server-side.

Regards,
KIR

0

You mean that files are retrieved on server, and sent back to the agent?
In fact we have some targets in our ANT build file that are updating some part of the depot during the build. The project configuration sets the project definition as //depot/xxx/... //team-city-agent/...
The existing ANT file doesn't know what's the mapping when it's run.
If the compiled files are not these that have been retrieved from the view (a copy). We have to find another solution to manage what we do today.

0

Yes. Checkout on agent feature is not available yet, watch request
http://www.jetbrains.net/jira/browse/TW-2103

You can workaround this problem if you manage the checkout process manually (i.e. you don't use TeamCity for checkout). In this case you should specify on first build configuration page

VCS Checkout mode: Do not checkout files automatically

and specify the location of your project on the build agent using "Build working directory" field.
In this case, your build script should handle checkout itself.

Hope this helps,
KIR

0

You mean that files are retrieved on server, and sent
back to the agent?
In fact we have some targets in our ANT build file
that are updating some part of the depot during the
build. The project configuration sets the project
definition as //depot/xxx/... //team-city-agent/...
The existing ANT file doesn't know what's the mapping
when it's run.
If the compiled files are not these that have been
retrieved from the view (a copy). We have to find
another solution to manage what we do today.


This has been a problem for me as well. See: http://www.jetbrains.net/jira/browse/TW-2103
My solution (workaround, really) has been to:
- Create a Perforce client spec for each build config.
- Set the client in "TeamCity's P4 Connection Settings"
- Add a command line option -DP4CLIENT= to TeamCity's "Additional Ant command line parameters" in the build client's Runner setup. - To make sure that the file permissions are correct in the workspace on the agent are correct (which they tend not to be), I have an ant target that runs before every build: ]]>

<p4sync force="true"
user="build"
client="$">
</p4sync>
</target>

This will work in my build env because I only have one build agent.
It probably won't work if you have multiple agents.

Hope that helps.

-Dave

0

Thanks for these informations and workaround.
We have several agents and it's not easy to deploy this solutions.

A typical case for our requirements is that we would like to put a label in perforce for successful builds.

0

Waiting for Benares that will help us to improve our way to manage our project.

0

I suppose it is still feasible with small modification to Dave's approach.

You can specify line like
env.P4CLIENT=]]>
in conf/buildAgent.properties file on your build agent and for your builds will receive P4CLIENT environment variable will be set.

You can also set P4CLIENT as system property if you'll use syntax
system.P4CLIENT=client name in buildAgent.properties

Hope this helps,
KIR

0

Please sign in to leave a comment.