一项 Jenkins 作业可以处理两种类型的构建吗?

发布于 2024-11-02 11:12:12 字数 517 浏览 1 评论 0原文

目前,我的团队正在使用 Jenkins 进行由 SVN 更改触发的自动化构建。

最近,我们决定使用声纳。我们不希望每个快照构建都发生声纳/哈德森集成。我们只想要每周一次左右。

我们的团队使用 clean deploy -U 而不是 clean deploy site-deploy -U,因此仅使用定期构建来触发声纳是不够的,因为它不会来自构建的站点信息(例如 clover 报告)。

我的问题是,在一项工作中,是否可以将不同的目标与不同的构建时间相关联?我可能不是很清楚。我可以将 clean deploy -U 关联到由 SVN 更改触发的构建,但将“clean deploy site-deploy -U”关联到由定期构建触发的构建吗?

我唯一的选择是

1. 说服每个人在每个快照构建中进行站点部署(从而花费更多时间)

2. 为每周构建创建一个新作业?

Currently my team is using Jenkins to do automated builds that are triggered by SVN changes.

Recently, we decided we wanted to use Sonar. We don't want to have the sonar/hudson integration occur for every single snapshot build. We just want it once a week or so.

Our team uses clean deploy -U instead of clean deploy site-deploy -U so simply using the periodical build to trigger sonar won't be enough because it won't have the site information from the build (such as the clover report).

My question is, in one job, is it possible to associate a different goal to different build times? I'm probably not being terribly clear. Can I associate a clean deploy -U to the build triggered by the SVN change but associate a 'clean deploy site-deploy -U' to a build triggered by the periodical build?

Are my only choices to

1. Convince everyone to have the site-deploy with every snapshot build (thus taking more time)

OR

2. Create a new job for the weekly build?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

苏大泽ㄣ 2024-11-09 11:12:12

我过去在工作中也有类似的经验,下面是我解决这个问题的方法。

只需对您需要的工具进行一些设置:

  1. Jenkins 声纳插件

我们面临的问题是,我们是否应该使用更多测试来运行构建,这会使构建时间更长,从而减慢我们正在制作的工具的实时测试速度。和你面临的情况类似。我们决定做的是创建两个构建,一个是为了与开发人员快速周转,另一个是需要更长的时间,每周运行一次,但根据您的情况,您可以简单地使用 Sonar 插件设置来解决您的问题,您可以通过手动构建或 SCM 轮询触发它。

当声纳在构建上运行时,您可以控制一些设置,安装插件后,转到配置系统。

在此处输入图像描述

我希望这会有所帮助,但它应该只需要一次构建即可实现所需的行为。 :)

I have similar experience in the past at work here below is how i solved the issue.

Just a little setup for the tools you will need:

  1. Jenkins Sonar Plugin

The problem we faced was should we run build with more tests which make the build time much longer, which slows down live testing of the tool we were making. Similar to the situation your facing. What we decided to do was to create two builds, once for the fast turn around with the developers and one that took longer that was run once as week, but with your situation you can simply use Sonar Plugins settings to solve your issue, you can have it triggered by manual build or SCM polls.

There are setting that you can control when the Sonar is run on the build, once you install the plugin, go to configure system.

enter image description here

I hope that was helpful, but it should result in the desired behavior with only one build. :)

压抑⊿情绪 2024-11-09 11:12:12

我不熟悉声纳以及如何调用构建,所以我不确定这个答案是您正在寻找的。

您可以使用 发布构建插件参数化构建 根据构建的调用方式选择不同的命令来运行。创建发布版本时,您可以在正常构建之前和/或之后使用不同的命令。发布版本通常是手动触发的,但您可以通过 Hudson CLI 或 API 从外部调用它。创建参数化构建时,您可以检查环境变量(传递给构建的参数)以选择应运行的命令。

不久前 Jenkins 用户邮件列表上有类似的问题,可能会提供一些有关如何使用参数化构建运行不同命令的附加信息。

I'm not familiar with sonar and how you invoke your build, so I'm not sure this answer is what you're looking for.

You can use either the Release build plugin or a Parameterized Build to choose different commands to run depending on how the build is invoked. When creating a Release build, you can different commands before and/or after the normal build. Release builds are usually triggered manually, but you could probably invoke it externally through the Hudson CLI or API. When creating a Parameterized Build, you can check an environment variable (the parameter passed to the build) to select what command should be run.

There was a similar question on the Jenkins user mailing list a little while ago that might provide some additional information about how to run different commands using Parameterized Builds.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文