Jenkins:如何从 Nexus 检出工件并在 Tomcat 上部署 - [英] Jenkins : how to check out artifact from Nexus and Deploy on Tomcat-

查看:43
本文介绍了Jenkins:如何从 Nexus 检出工件并在 Tomcat 上部署 -的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我准备建立一个 Jenkins 管道.第一阶段完成,代码编译、测试、检查并部署到 Nexus.

我现在想在管道上进行第二阶段,从 Nexus 检出战争并部署在 tomcat 上.

其实我已经集成了maven-tomcat插件部署在Tomcat上.我的问题是如何查看战争的最新版本?

是否有任何 maven 或 jenkins 插件?

非常感谢,

帕特里克

解决方案

理想情况下,您的二进制存储库管理器 (Nexus) 应该在您的整体架构中占据以下位置:

您可以使用 Jenkins 作为您的配置工具,但理想情况下,它应该启动某种过程,将工件直接从 Nexus 中提取出来(如果没有别的,它会更有效).

这比听起来容易得多.例如,可以从 shell 脚本调用 Nexus REST API 以下载任何所需的工件修订版.例如:

$CATALINA_HOME/bin/shutdown.shcurl -o $CATALINA_HOME/webapps/myfile.war http://myrepo.com/service/local/artifact/maven/redirect?r=releases&g=com.myorg&a=myfile&v=1.1.1&e=战争$CATALINA_HOME/bin/startup.sh

最后,也许您可​​能希望考虑使用专用系统来管理您的部署?我一直在玩的一个有趣的解决方案是 rundeck,它有一个用于 詹金斯.我真的很喜欢 rundeck,因为它的简单性是它与 Jenkins 共有的一个特点.还有一个用于 Nexus 的插件,使 rundeck 能够提供符合部署条件的人工制品的下拉列表.>

I am tying to set up a Jenkins Pipeline. The first stage is done, the code compiles, is tested, inspected and deployed to Nexus.

I would like now to make a second stage on the pipeline where the war is checked out from Nexus and deployed on tomcat.

Actually I already integrated the maven-tomcat plugin to deploy on Tomcat. My question is how can I check out the latest build of the war ?

Is there any maven or jenkins plugin for that ?

Many thanks,

Patrick

解决方案

Your binary repository manager (Nexus) should ideally occupy the following position in you overall architecture:

You can use Jenkins as your provisioning tool, but ideally it should launch some sort of process which pulls the artifact to be deployed directly from Nexus (If nothing else it's more efficient).

This is a lot easier than it sounds. For example the Nexus REST API could be called from a shell script to download any desired revision of an artifact. For example:

$CATALINA_HOME/bin/shutdown.sh
curl -o $CATALINA_HOME/webapps/myfile.war http://myrepo.com/service/local/artifact/maven/redirect?r=releases&g=com.myorg&a=myfile&v=1.1.1&e=war
$CATALINA_HOME/bin/startup.sh

Finally, perhaps you might wish to consider a dedicated system for managing your deployments? An interesting solution I've been playing with is rundeck, which has a plugin for Jenkins. I really like rundeck, due to it's simplicity a trait it shares with Jenkins. There is also a plugin for Nexus that enables rundeck to provide a pull down list of artfacts eligible for deployment.

这篇关于Jenkins:如何从 Nexus 检出工件并在 Tomcat 上部署 -的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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