配置 Hudson 以部署构建 [英] Configuring Hudson to deploy a build

查看:18
本文介绍了配置 Hudson 以部署构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试配置 Hudson,以便能够自动将构建(.war 文件)部署到 Tomcat.然后有人会使用新部署的构建来测试应用程序.

I'm trying to configure Hudson so that I will be able to automatically deploy a build (a .war file) to Tomcat. The newly deployed build will then be used by someone to test the application.

我尝试使用 Deploy Plugin 自动部署 .war 文件,这很有效.但是,构建 .war 文件的作业将在每次 scm 更改后运行(无论何时提交代码).使用 Deploy 插件,每次构建时都会将 .war 文件部署到 Tomcat.由于代码被频繁提交,这意味着Web应用程序也将频繁重启,这将中断测试过程.

I've tried using the Deploy Plugin to automatically deploy the .war file, and this works. However, the job that builds the .war file will run after every scm change (whenever code is committed). With the Deploy Plugin, the .war file would be deployed to Tomcat every time a build is made. Because code is commited frequently, this will mean that the web application will be restarted frequently as well, and this will interrupt the testing process.

我很欣赏 Hudson 会定期运行我的单元测试并进行构建,因此我不想更改这项工作的触发器.

I appreciate the fact that Hudson runs my unit-tests and makes a build regularly, so I don't want to change the triggers for this job.

我正在寻找一种可以手动决定从 Hudson 内部部署的方法.我尝试创建一个单独的作业,该作业将从第一个作业部署 .war,但这不起作用.有没有人有这样设置的经验?

I am looking for a way that I can manually decide to deploy from within Hudson. I tried creating a separate job that will deploy the .war from the first job, but this didn't work. Does anyone have any experience setting something like this up?

推荐答案

如何获取工件

查看 部署插件页面.它描述了基本思想.它使用 Copy Artifact Plugin 从构建中复制工件工作到您当前的工作(部署工作).从那里您可以执行与构建步骤相同的操作.

How to get the artifacts

Look at the section "How to rollback or redeploy a previous build" on the Deploy Plugin Page. It describes the basic idea. It uses the Copy Artifact Plugin to copy the artifacts from the build job to your current job (the deploy job). From there you do the same that you did in your build step.

开始部署后无法触发构建作业,因此首先运行构建然后再运行部署作业.所以有几个选择:

The build job can not be triggered after you start the deploy so that first a build runs and than the deploy job. So there a a few options:

  • 手动触发构建.开始部署的用户需要选择构建作业的特定运行.
  • 计划部署这可能是夜间任务的一部分.作业会在某个时间间隔(如每晚或每个周末)触发.由于它是自动化的,因此部署作业应该选择最后一次成功的构建(那时您不需要参数化作业).您没有机会传递运行编号.
  • 每次构建成功完成时都会触发部署作业(不符合您的要求,但列出以完成列表)
  • 一些其他(深奥的)触发器.这可以是许多不同的想法,例如通过调用构建 URL 远程触发.呼叫可以来自您的票务系统、测试实验室管理系统或您喜欢的任何其他系统.您还可以通过源代码控制系统中的特定更改来触发部署,例如更改版本号(例如,由提交消息中的关键字标记).这个触发器可以在 Hudson 内部或外部实现.还有其他可用的触发器.这包括但不限于 html 页面更改、文件系统受监控部分的更改、IM 消息、电子邮件.前三个由 Hudson 插件实现.查看插件列表,了解哪些是可用的或者在这两种情况下,您都需要确保构建作业归档了部署所需的所有工件.
  • manually trigger the build. The user that starts the deployment needs to select a specific run of the build job.
  • scheduled deployment This could be part of the nightly tasks. The job gets triggered at a certain interval (like every night or every weekend). Since it is automated, the deploy job should pick up the last successful build (you don't need a parametrized job then). You don't have a chance to pass in a run number.
  • the deploy job gets triggered every time a build finishes successful (doesn't fit your requirement, but listed to complete the list)
  • Some other (esoteric) trigger. This can be many different thinks e.g. remotely triggered by calling the the build URL. The call can come from one of your ticketing systen, test lab management system, or any other system you like. You can also trigger the deployment, by specific changes in your source control system, like changing the release number (e.g. marked by a keyword in the commit message). This trigger can be implemented within or outside of Hudson. There are other triggers available too. This includes but is not limited to html page change, change on a monitored part of the file system, IM message, email. The first three are implemented by a Hudson plugin. Have a look at the plugin list, to know what is all evailable or In both cases you need to make sure that the build job archives all artifacts needed for deployment.

这篇关于配置 Hudson 以部署构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆