0
votes

This question is similar to the question being asked at How to configure a single Jenkins job to make the release process from trunk or branches? however in this case Perforce is the SCM being used within Jenkins. Currently in Jenkins I have the following:

  1. One release job per branch/trunk.
  2. Each job has a separate Perforce workspace mapping the necessary branch/trunk
  3. Upon running the job, the jenkins-perforce-plugin synchronises the complete workspace and then runs the maven release plugin.

Ideally I would like to have one release job that can point to any branch, synchronise to the code from that branch and carry out a maven release. However, with Perforce workspaces, I will require a view mapping for each branch/trunk. Is there are way to tell the jenkins-perforce-plugin to only synchronise to a particular view in the workspace view? This way I could build the release job with a parameter that passes in the branch path and the jenkins-perforce-plugin synchronises to jobs perforce workspace to this path only and then carries a build from there.

1

1 Answers

0
votes

If I were trying to implement this as described I would created a parameterized build where I could hand in a Perforce label name. The Perforce Jenkins plugin can sync to a label; I would create labels for each release specifying the paths that should be synced and with a revision specifier of #head.

Jenkins should then sync just the files you want for that build. The workspace would of course map everything; the labels will specify the files to fetch.