简体   繁体   English

詹金斯·格里特触发器的理想用法

[英]Jenkins Gerrit Trigger ideal usage

In my company we are already using Gerrit and we would want to integrate it with Jenkins for one project. 在我的公司中,我们已经在使用Gerrit,我们希望将其与Jenkins集成到一个项目中。 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. 我们有一台开发服务器,将在该服务器上运行该应用程序并安装Jenkins,而Gerrit和实际回购将在另一台服务器上。 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. 我们的目标是在每次更改合并到dev分支上时,在一台服务器上同步应用程序并运行一些脚本以进行构建。 The idea is not to perform builds on the Gerrit server, but on the server where our application runs. 这个想法不是在Gerrit服务器上执行构建,而是在我们的应用程序运行所在的服务器上执行。 The Gerrit Jenkins plugin seems to be an ideal tool for such a task, as it would trigger builds on Gerrit events. Gerrit Jenkins插件似乎是完成此任务的理想工具,因为它将触发基于Gerrit事件的构建。 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. 但是,我无法针对我们的具体情况(基本上是将文件从A复制到B并在B上运行脚本)提出任何理想的工作流程或设置,因为我不知道在使用Gerrit插件时是否预期该项目建立在特定分支上,或可以建立在任何地方。

Jenkins expects the code to be downloaded from the Gerrit server to the Jenkins server for running your build scripts. Jenkins希望将代码从Gerrit服务器下载到Jenkins服务器,以运行您的构建脚本。 Most users of the Gerrit Trigger Plugin use the Jenkins Git Plugin to accomplish this. Gerrit触发插件的大多数用户都使用Jenkins Git插件来完成此任务。 See the guide at https://wiki.jenkins-ci.org/display/JENKINS/Gerrit+Trigger#GerritTrigger-UsagewiththeGitPlugin . 请参阅位于https://wiki.jenkins-ci.org/display/JENKINS/Gerrit+Trigger#GerritTrigger-UsagewiththeGitPlugin的指南。

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 . 例如,在Linux上,该目录位于/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. 为什么不使用rsync的代码将代码移至最终目标。 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 成功部署文档: rsync doc/html/ 192.168.0.1:/var/www/doc/project

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM