Hi, Iata: Thanks for your detailed info. But I still have some questions. To keep it simpler, I did the following:
I created a super simple test case. It would be great if you can point out where I may be wrong. I just want to have a simple test of using P4 Jenkins plugin. My steps are below: 1) Following the P4 wizard, I created a workspace named "test", which point to the root of the directory /home/abigail/p4/test/test1 on my local machine. Please see the attached "p4-workspace.png" 2) In the P4 depot there are two projects, "test1" & "test2", and test1 maps to the workspace "test". Please see "p4-depot.png" 3) In Jenkins, I typed the workspace name "test" and the view map "//depot/test1/... //test/...". Please see "P4-jenkins.png" 4) admin@Jenkins:~$ p4 info User name: admin Client name: test Client host: Jenkins Client root: /home/abigail/p4/test/test1 Current directory: /home/admin Peer address: ... Client address: xx.xx.xx.xx Server address: xx.xx.xx.xx:1666 Server root: /opt/p4d Server date: 2015/07/22 01:42:32 -0400 EDT Server uptime: 00:32:40 Server version: P4D/LINUX26X86_64/2015.1/1171507 (2015/06/30) Server license: none Case Handling: sensitive My Jenkins is installed by default /var/lib/jenkins/.... Event time the Jenkins build finishes, the root of the workspace "test" changes to "/var/lib/jenkins/..." from /home/abigail/p4/test/test1 on my local machine. This is not the right behavior, or not the good practice, right? I need the root directory "/home/abigail/p4/test/test1" on my local machine because all my project resides in this directory, and I can sync with P4, but this root is not known by Jenkins, so it copies all files from my local workspace root directory to Jenkin's default installation location /var/lib/jenkins... for each build. I guess my setting of workspace root isn't quite right? But I just followed the P4 wizard to create the workspace, and I can syc with P4 correctly. The problem is when Jenkins comes into play. Please use simple or step-wise language to help me get this configured properly. This is a simple typical setup. I want to configure nothing Unique or Special. Thank you. Martin On Tuesday, July 21, 2015 at 5:41:43 AM UTC-4, lata wrote: > > 1) What's the problem here? > > 1. Jenkins Perforce Workspace at /var/lib/jenkins/jobs/... > - The name of this P4 workspace is whatever you have typed in the > 'Workspace' field of your Jenkins project configuration -> Perforce > section. I'm guessing you typed in 'jenkins_test'. > - The P4 root of this P4 Workspace would be relative to your slave's Remot > Root or your Jenkins Master (if you are running your project directly on > Jenkins Master, and not on a slave). > - Default behaviour is that Jenkins updates the P4 workspace with the Root > and Host values, you can override this by checking the 'Don't update client > workspace' option in the Advanced section. > > 2. Your Perforce workspace, 'jenkins_test', with root /home/maritn/p4/test > Jenkins is not aware that you have such a P4 workspace created, and that > you want to use it. As mentioned above, it will override Root and Host > unless you ask it not to. > > Reco: 1. If you really can't go with the Jenkins chosen workspace to sync > your p4 code to, don't use the option 'Don't update client workspace', > instead use the 'custom workspace' in the Advanced project option, and > change the workspace location to /home/martin/<somedir>, if you need to. > Don't manage this Jenkins created P4 workspace outside this environment, > let Jenkins manage it. (I'm assuming you can't get a slave machine, and > need to run your jobs on the Master itself? Otherwise you can straightway > set your Slave's remote root location to the right place that you want) > 2. If you really need to use your Perforce client created outside for some > reason, then use the command line within Jenkins config shell and do a > manual sync such as P4 -c $yourclient > > 2) Does the user "jenkins" on Jenkins have anything to do with the Linux > user who installed Jenkins and P4? > No > > > On Tuesday, July 21, 2015 at 3:36:32 PM UTC+8, Martin wrote: >> >> Hello, it's the first time to setup Jenkins Perforce Plugin. I just >> wanted to setup a simple project to test the automatic build feature in >> Jenkins. On my local machine, my project is: >> >> /home/martin/p4/test >> >> I created a workspace named jenkins_test, whose root >> is /home/martin/p4/test. I can test syncing with Perforce. >> >> However, in Jenkins, whenever a build finishes, it changes my root >> directory of my workspace from /home/martin/p4/test to >> /var/lib/jenkins/jobs/.... on the Jenkins machine. This isn't the expected >> behavior, right? Otherwise, I have to change the root of the workspace back >> to /home/maritn/p4/test on my local machine after each build. >> >> In Jenkins, I created a user named "jenkins" and use that user name to >> login Jenkins to start the build and do the configure. >> >> I have a few questions here: >> 1) What' the problem here? >> 2) Does the user "jenkins" on Jenkins have anything to do with the Linux >> user who installed Jenkins and P4? >> >> Thank you for help. >> >> >> > -- You received this message because you are subscribed to the Google Groups "Jenkins Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/e9d6497d-581a-4b82-88ad-2089f2156b2c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.