How to Sync the Latest Code From Perforce Repository Using Jenkins?

Scenario

Suppose you are running your scripts on client Machine or VM machine. In that case you have to always sync the latest code on the target machine manually. However, if you are using Jenkins, then you can implement and sync the latest code easily before running the scripts.

 Steps 

  1. Go to the target machine (client Machine or VM machine where your scripts will run) and open command prompt.
  2. Type the command: ‘p4 client’ and press ENTER button.
  3. Client file will open and update the ‘Client:’ and ‘Root:’ information. Here, ‘Client:’ is your perforce’s work space name (Test_perforce) and ‘Root:’ is the location (C:\etc) where code will be saved.
  4. Save the opened file.
  5. Now open the environment variable and set ‘P4CLIENT’ into ‘Test _perforce’ (perforce work space name).
  6. Restart the machine.
  7. Open the Jenkins URL
  8. Open the Jenkins Job.
  9. Add ‘Execute Window Batch Command’ option before executing your scripts.
  10. Enter the below mentioned code with correct user/password.
p4 set P4USER=[perforce user] P4PASSWD=[password]
p4 sync -f //etc/qa/Automation/selenium/adaptiveinsight/main/...[Location of your project]

How to Sync the Latest Code From Perforce Repository Using Jenkins

  11. Now run the Jenkins job.

You might also like: How to Change the Data into Properties File Using Jenkins?

SHARE THIS

Get A Free Quote

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.