持续集成服务器初学者
我正在尝试设置一个完整的 CI 服务器,但我在某些方面遇到了困难。
目前,我的系统工作如下:
我在本地 GIT 存储库上提交本地更改,然后推送到 CI 服务器上的 GIT 存储库
然后,我有一个由 SCM 更改触发的 jenkins 作业,它运行全新安装,并通过这样做执行我的所有 Junit 和 Jstestdriver 测试(通过本地 jstd 服务器)。此作业将快照工件部署到我的 nexus 存储库上的存储库
我为 jenkins 安装了 M2-release-plugin,并使用 maven-release-plugin 相应地设置了我的 pom.xml。当我在 jenkins 作业页面中单击“执行 maven 发布”时,jenkins 运行 mvn release:prepare release:perform,从而在我的 git 存储库中创建一个标记(例如 v000001),并在我的 Nexus 存储库上部署版本化工件。
我真的不知道这个过程是否正常,但我想是这样...
我的问题是我想在我的生产 tomcat 中交付我的 Nexus 存储库中的版本化工件(例如“artifact-v0000001.war”)。但我不知道该怎么做。
当我执行“mvn release:prepare release:perform tomcat:deploy”时,它会部署构建的新快照工件......我不想这样做,我想重用nexus存储库中的工件。
有没有办法使用工具(maven/jenkins 插件或外部)来执行此操作?
基本上,我想获取存储库中的最后一个版本工件,并将其发送到 tomcat 管理器以取消部署 web 应用程序。
我是否需要设置与发布作业分开的交付作业?
I'm trying to setup a complete CI server, but I struggle on some points.
Currently, my system work as follow :
I commit local changes on my local GIT repository, then push to the GIT repository on the CI server
I then have a jenkins job triggered by the SCM change, who run a clean install and by doing so executes all my Junit and Jstestdriver test (via a local jstd server). This job deploy the snapshot artifact to a repository on my nexus repository
I installed M2-release-plugin for jenkins, and setup my pom.xml accordingly using maven-release-plugin. When i click on "Perform maven release" in jenkins job page, jenkins run mvn release:prepare release:perform, thus creating a tag in my git repo (say v000001) and deploying a versionned artifact on my nexus repository.
I don't really know if this process is fine, but i guess so...
My problem is that I want to deliver the versionned artifact in my nexus repo (say "artifact-v0000001.war") in my production tomcat. But I can't figure out how to do it.
When I do "mvn release:prepare release:perform tomcat:deploy" it deploys the new SNAPSHOT artifact built ... I don't want to do this, I want to reuse the artifact from the nexus repository.
Is there a way to doing this using a tool (maven/jenkins plugin, or external)?
Basically, I want to fetch the last release artifact on the repository, and send it to the tomcat manager for dereploying the webapp.
Do I need to setup a delivery job separated from the release job?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Jenkins,尤其是与 ANT 这样的工具结合使用时,几乎可以做任何事情。它有很多插件,您随时可以编写脚本并将其合并到 Jenkins 构建中。目前,我使用 Jenkins 将 Web 应用程序部署到 Windows IIS 服务器。您在这里可以做的是让 Jenkins 构建在源代码控制部分设置您的 SVN 路径,以便在您触发构建时获取最新版本。从这里开始,编写一个 ANT 脚本将其复制到 Tomcat 中现有的 JAR 上应该是相当简单的,这将自动重新启动它。
Jenkins, especially when combined with a tool like ANT, can do just about anything. It has a lot of plug-ins, and you can always write a script and incorporate it into a Jenkins build. Currently, I use Jenkins to deploy web applications to Windows IIS servers. What you could do here is have a Jenkins build that has your SVN path set in the source control section so that it fetches the latest version when you trigger the build. From there it should be fairly trivial to write an ANT script that copies it over the existing JAR in Tomcat, which will automatically restart it.
您的问题是您可能正在使用 Jenkins 发布插件,而不是“m2 发布插件”。标准插件的问题在于它执行常规构建,保存工件,然后执行发布。然后,它将尝试部署从常规构建中创建的错误工件。
m2 发布插件解决了这个特殊问题。对于这个问题有一些棘手的解决方法,但在实现此功能之前,这就是目前的情况: https://issues.jenkins-ci.org/browse/JENKINS-11120(登录并投票!)
Your problem is that you are probably using the Jenkins release plugin, not the "m2 release plugin". The problem with the standard plugin is that it performs the regular build, saves the artifacts, then performs the release. It will then try to deploy the wrong artifacts that it created from the regular build.
The m2 release plugin solves this particular problem. There are some tricky workaround for this problem, but that's how it stands at the moment until this feature is implemented: https://issues.jenkins-ci.org/browse/JENKINS-11120 (log in and vote for it!)