ModdyFire
ModdyFire

Reputation: 736

Jenkins: Control workspace location in perforce

I'm trying to write a Jenkins job for compiling on several platforms. For this, I need the client to be created not in the default location (C:\Jenkins\workspace\MY_JOB) but on a network location (\somecomputer\somewhere.)

I tried to unclick "Let Jenkins Create Workspace" and create the workspace myself. However, it fails. I see in the log:

"C:\Program Files\Perforce\p4.exe" workspace -o MY_JOB-230942967

I can't figure out what this number is, and why perforce plugin adds it there, and what I may do about it.

Upvotes: 3

Views: 11365

Answers (2)

Ignacio Fernández
Ignacio Fernández

Reputation: 111

Open the "Advanced" settings section on the Source Code Management bit of the job configuration, and then look for

Client name format for slaves

it's, by default, ${basename}-${hash}. Delete the hash part and you should be good to go.

Upvotes: 9

Tuxdude
Tuxdude

Reputation: 49473

You need to configure the perforce workspace name and paths correctly for each project you want to build using jenkins. Prior to that I would suggest setting up a perforce workspace (i.e. client) for this mapping using p4 or p4v.

  1. Go to Jenkins webpage, and select the project you want to change
  2. Select Configure in the left pane.
  3. Under source code management make sure Perforce is selected, and P4PORT, username and password are valid as well.
  4. For Workspace (client), enter a valid workspace name aka the client name you pass to the p4 client command. Jenkins would create one for you if one such does not already exist if you check Let Jenkins Create Workspace
  5. Select View Map for the Client View Type.
  6. Enter the correct perforce mapping like you would specify in your p4 client. For example to map the depot location //depot/branch1 to some path Z:\workspace1\somedir\branch1 in your client called myclient1 whose Client root is set at Z:\workspace1, you would need to add the following line:

    //depot/branch1/... //myclient1/somedir/branch1
    

Upvotes: 3

Related Questions