存档工件,不能在工作区时构建失败 [英] Archiving artifacts not in the workspace when build fails

查看:265
本文介绍了存档工件,不能在工作区时构建失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当一个Ant构建的步骤在我的构建失败,我想,以确定问题的归档日志。相关的记录,但是,不在工作区,所以我必须使用完整的路径给他们。

When an ANT build step fails in my build I'd like to archive the logs in order to determine the problem. The relevant logs, however, are not located in the workspace, so I have to use a full path to them.

标准神器归档功能不完整路径很好地工作,所以首先我必须将日志复制到工作区的一些构建步骤中,这样我可以在以后归档。我不希望合并复制code到原来的ANT脚本(它并不真正属于那里)。在另一方面,由于生成步骤失败构建我不能执行code那份工件到工作区作为一个单独的构建步骤作为永远达不到的。

The standard artifact archiving feature does not work well with full paths, so first I have to copy the logs into the workspace within some build step so that I can later archive them. I do not want to incorporate the copying code into the original ANT script (it does not really belong there). On the other hand, since the build step fails the build I can't execute the code that copies the artifacts into the workspace as a separate build step as it is never reached.

-keep持续选项,但我怎么会那么构建失败?

I am considering using ANT -keep-going option, but how will I then fail the build?

任何其他的想法(即适当地处理完整路径,例如神器插件)?

Any other ideas (artifact plugins that handle full paths gracefully, for example)?

更新:我已经通过创建工作区包含要归档的文件目录的符号链接解决此问题的工作。缺憾,但有效的

Update: I've worked around the problem by creating a symbolic link in the workspace to the directory that contains the files to be archived. Kludgy, but effective.

推荐答案

我会建议使用的灵活的发布插件与有条件的构建步骤插件。

I would recommend using Flexible Publish plugin in conjunction with the Conditional Build Step plugin.

该灵活的发布插件允许你安排建设构建步骤都正常运行后的步骤。这可以让你捕捉成功和失败的建立和执行的东西 - 比如说一个脚本,从外面工作区中的文件复制到里面的工作区。有条件BuildSet插件允许conditionalizing的步骤,使他们只有当构建失败运行。使用这两个插件,您可以将文件复制到故障后,工作区,然后用通常的詹金斯机制归档。

The Flexible Publish plugin allows you to schedule build steps AFTER the build steps have normally run. This allows you to catch both successful and failed builds and execute something - say a script that copies the files from OUTSIDE the workspace to INSIDE the workspace. The Conditional BuildSet plugin allows conditionalizing the steps so that they only run when the build fails. Using these two plugins, you can copy the files into the workspace upon failure, then archive them with the usual Jenkins mechanisms.

这篇关于存档工件,不能在工作区时构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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