I'm currently setting up a Jenkins pipeline for a web application and am wondering which methods of deployment are most common or recommended.

Currently Jenkins polls the SCM for new commits and triggers build when there are new commits.

Assume that the build process is:

composer install

phpunit tests

rsync workspace to staging server

behat --profile staging

Question is how to deploy?

Should I rsync the files directly from the jenkins workspace which have already run the build process and passed unit tests? Or should I hold a clone of the repository on the staging/production servers and trigger a git pull and then a subsequent build on the server to deploy to?

Or anything else I haven't thought of?

1 Answer 1


I would deploy directly from the Jenkins workspace. The reason is that if you're performing git pull, it may pull newer version than what Jenkins built. Of course, "git checkout SHA1" could save your day, but really, if the Jenkins server is compatible with the deployment server, there is no reason to spend additional time to re-compile the thing.

Of course, if your web application is written using C or a similar language (unlikely as they aren't often used for web applications), there is theoretical possibility that the shared library version numbers on the Jenkins server and the deployment server differ. So, in this case, recompilation may be necessary.

My advice thus would be to try first deploying directly from the Jenkins workspace. If for some reason it does not work, then switch to using git pull and recompiling.

  • Thanks for your answer, this makes a lot of sense and is exactly one of the considerations I was missing! Commented Mar 15, 2017 at 15:25
  • 1
    This also underlines the reason to have your build / test machines and staging / prod machines on exactly the same OS versions and general configuration.
    – 9000
    Commented Mar 15, 2017 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.