0

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.

Community
  • 1
  • 1
user1638152
  • 577
  • 11
  • 23

1 Answers1

0

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.

Matt
  • 4,860
  • 1
  • 17
  • 15
  • 1
    Thank you Matt. The way I think I will be tackling this problem is to set up a Jenkins job with a perforce workspace that has a view of all branches and trunk. I will make the job a parameterised job where the branch name or trunk name is parsed to the job and use the "Use View Mask" setting in the Advanced perforce plugin settings for the job to synchronise the code to a specific area of the job's perforce workspace. Labels would not be good for me as it would mean I would have to create a release label before building the release. – user1638152 Aug 22 '13 at 10:14
  • That sounds like a great solution! I haven't played with the view mask setting; sounds like a handy addition. – Matt Aug 23 '13 at 20:43