Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Is there a way to create a perforce clientspec from a repository object in groovy without syncing it? #4252

tomz ·

Is there an easy groovy script that does nothing but create the clientspec on the perforce server for a given repo (or modifies it if it already exists) without doing an actual sync? I can't seem to locate such a thing easily in the quickbuild documentation.

  • replies 4
  • views 1548
  • stars 0
robinshen ADMIN ·

So you want to create/sync an agent on Perforce server based on client spec defined in a QB p4 repository? If so, you may use below script:

groovy:
repositories.get("repo name").setupClient();
tomz ·

It is important in this case to create the clientspec without syncing. Is that possible? I've tried that command and it definitely ends up syncing as well.

robinshen ADMIN ·

When calling setupClient() along, QB will executes "p4 client -i" to update the client spec only. I tested with below step and no files are synced to workspace:

  1. Create a test configuration and add a Perforce repo with desired client spec
  2. Inside master step add a step of type "Misc / Execute Script" running below script:
    groovy:
    repositories.get("p4 repo").setupClient();
  3. Now run this configuration. The client will be created at Perforce server with expected spec. Also check the client root directory, there is no files retrieved/synced

Make sure you do not add the checkout step into master when test above.

tomz ·

That does appear to work, thank you!