哈德逊依赖 [英] Hudson dependencies

查看:32
本文介绍了哈德逊依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了我的 hudson 工作 A.工作 A 依赖于工作 B 和 C.我已经使用构建其他项目"来设置它们.这很有效,尽管每个作业都在我的工作区(默认结构)中的单独目录中.但是我需要在作业 A 工作区(根文件夹)中的作业 B 和 C.

I have set up my hudson job A. Job A depends on job B and C. I have set them up with "Build other projects". This works well, although each job is in separate directory in my workspace (default structure). But I need job B and C in jobs A workspace (root folder).

我考虑了两种方法:

  1. 更改作业 A 的工作区并通过在其他项目上触发参数化构建"将该变量推送到作业,然后使用 ant 构建脚本将它们复制到该位置,因为我找不到更改作业 B 所在文件夹的选项或者 C 应该去
  2. 作为作业 A 的一部分,从构建脚本触发作业 B,然后是 C.这是通过远程调用完成的(在 stackoverflow 的某处找到),但我的配置中缺少该选项,我找不到任何可以添加它的插件.

对我来说理想的方法是使用 ant 构建脚本并从那里使用 antsvn 或类似的东西触发作业 B 和 C.但我找不到一个可靠的例子.

Ideal approach for me would be to use ant build script and trigger job B and C from there with antsvn or something like that. But I cant find a solid example of this.

我想要这种方式的原因很简单 - 作业 B 是 CMS,这对作业 A 至关重要,而作业 C 具有需要在新版本登陆生产服务器之前执行的 python 脚本(这已经通过 py-蚂蚁).

Reason why I want it this way is simple - job B is CMS which is essential for job A and job C has python scripts that need to be executed before new version can land on production server (this is already done with py-ant).

或者也许有更好的方法来管理这样的依赖项.任何帮助表示赞赏.

Or maybe there is some better way to manage dependencies like this. Any help is appreciated.

我希望这是有道理的.

推荐答案

将作业B"和C"视为生产作业A"所需的工件".然后,您只需在构建作业A"时导入作业B"和C"生成的工件.

Think of Jobs "B" and "C" as producing "artifacts" that Job "A" needs. Then, all you have to do is import the artifacts produced by Jobs "B" and "C" whenever you build Job "A".

您的工作不应共享工作区.否则,如果在触发作业B"或C"时正在构建作业A"会发生什么?您将同时进行多个构建.但是,如果您将A"与作业B"和C"的需要分开,您可以让作业A"导入这些依赖项.有两种方法可以做到这一点:

Your jobs shouldn't share workspaces. Otherwise what happens if Job "A" is building when Job "B" or "C" is triggered? You'll have multiple builds going on at once. However, if you separate out what "A" needs from jobs "B" and "C", you can have Job "A" import those dependencies. There are two ways of doing this:

  • 困难但正确的方法:您应该创建一个发布存储库,作业可以在其中获取所需的工件.如果这对您来说听起来Mavinish,那么,确实如此.但是,我在没有 Maven 项目的情况下使用了 Maven 架构的东西,它运行良好.您可以使用 Artifactory 或 Nexus 之类的东西作为您的发布存储库.然后使用 wgetcurl 从存储库中获取项目并使用 Maven 的 deploy:deploy-file 插件发送这些内容.您将需要 Maven(它是一个 Java 进程)来运行 deploy:deploy-file,但您不需要 Maven 项目,甚至不需要 Java 项目.deploy:deploy-file 插件甚至不需要 Maven pom.xml 文件.把它想象成一个命令行实用程序,用于将内容发送到您的发布存储库.
  • 简单但不正确的方法:Hudson 有一个 Copy Artifacts 插件,您可以使用它来执行此操作.问题是它很容易设置,但很难开始跟踪.另外,它使您依赖于一个非常具体的工具.如果您决定离开 Hudson,您可能无法复制此功能.
  • The hard but correct way: You should create a release repository where jobs can fetch the artifacts they need. If this sounds Mavinish to you, well, it is. However, I've used Maven architectural stuff without Maven projects and it works fine. You can use something like Artifactory or Nexus as your release repository. Then use wget or curl to fetch the items from the repository and use Maven's deploy:deploy-file plugin to send the stuff over. You will need Maven (which is a Java process) to run deploy:deploy-file, but you don't need a Maven project, or even a Java project. The deploy:deploy-file plugin doesn't even require a Maven pom.xml file. Think of it more like a command line utility to send stuff to your release repository.
  • The easy, but incorrect way: Hudson has a Copy Artifacts plugin that you can use to do this. The problem is that it's easy to setup, but hard to start tracking. Plus, it makes you dependent upon a very specific tool. If you decide to move away from Hudson, you might not be able to duplicate this functionality.

这篇关于哈德逊依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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