AnupamBhusari
AnupamBhusari

Reputation: 2415

How to sync to a Perforce pending changelist in jenkins

I have a pending changelist that I want to test in the build on our Jenkins server. I tried to do this using a P4 label but syncing to the label does not pick up my pending changelist.

Is there any way to do this with Jenkins SCM configuration?

Upvotes: 1

Views: 3429

Answers (2)

xxnations
xxnations

Reputation: 645

You can use the P4 Plugin. Follow the below steps

  1. Create a Jenkins Job
  2. Select checkbox: This project is parameterized
  3. Add parameter name as Changelist
  4. For the first step of build, select the option perforce unshelve and use ${changelist} as Changelist and resolve type as per your requirement
  5. Under Build Trigger, select Trigger builds remotely (e.g., from scripts)

To trigger the build:

  1. Shelve the Changelist
  2. Trigger build with URL http://jenkinurl/projectname/buildWithParam?changelist=< shelved_cl >

Upvotes: 1

Bryan Pendleton
Bryan Pendleton

Reputation: 16359

In general, unless you have some very special circumstances, no other workspace can sync your pending changelist's changes, because they exist ONLY on your own workstation, not on the server. The server knows the names of the files in your pending changelist, but not their contents.

To make your changes accessible to the automated build tools, there are generally two approaches:

  1. You can shelve the changes, then instruct the build tool to build from the shelf, or
  2. You can check your changes into a development branch, then instruct the build tool to build the branch.

Or, of course, you could check your changes into the mainline, and have the build tools build them normally, but I'm guessing from your question you don't want to do that.

Upvotes: 1

Related Questions