Question

In my company we are already using Gerrit and we would want to integrate it with Jenkins for one project. We have a dev server where the application would run and Jenkins will be installed, while Gerrit and the actual repo will be on a different one. Our goal is to sync the application on one server and run some scripts for building every time changes get merged on the dev branch. The idea is not to perform builds on the Gerrit server, but on the server where our application runs. The Gerrit Jenkins plugin seems to be an ideal tool for such a task, as it would trigger builds on Gerrit events. However, I cannot come up with any ideal workflow or setup for our specific situation (basically copying files from A to B and running scripts on B), because I do not understand if, when using the Gerrit Plugin, the project is expected to be built on a specific branch or can be built anywhere.

Was it helpful?

Solution

Jenkins expects the code to be downloaded from the Gerrit server to the Jenkins server for running your build scripts. Most users of the Gerrit Trigger Plugin use the Jenkins Git Plugin to accomplish this. See the guide at https://wiki.jenkins-ci.org/display/JENKINS/Gerrit+Trigger#GerritTrigger-UsagewiththeGitPlugin.

OTHER TIPS

The project will always be build in the job workspace. For example on Linux this would be in /var/lib/jenkins/jobs/job-name/workspace. The workspace will be a clone of your repository and will be checked out to the branch that you wish to build.

So when you ask if you can specify a destination then I would say: No, this can not be done.

Why don't you use something like rsync to move your code to the final destination. This is what we use to deploy the latest documentation for our dev team.

  1. Build software
  2. Generate documentation
  3. On success deploy docs: rsync doc/html/ 192.168.0.1:/var/www/doc/project
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top