我安装了Deploy Plugin
在我的 Jenkins
上,以便自动将我的 Maven
构建的 war
包部署到 Tomcat 7
。问题是,只有当它们是在使用部署插件的同一作业中进行时,我才能使用该插件部署到远程 Tomcat 服务器。换句话说,我无法设置一个独立的作业来部署由不同作业制作的工件。
例如,我有一个名为 pack.foo 的作业。它使用/var/lib/project/module中的源代码创建module.war并将其放入/var/lib/project/module/target中。但是,由于 Maven 版本设置的原因,pack.foo 的工件页面上发布的工件类似于 module-2.0.0-SNAPSHOT.war。
我能够部署 module.war 的唯一方法是向 pack.foo 添加一个 Post-build Action
并将 **/module.war 指定为远程 Tomcat 管理器 URL (前提是我在 Jenkins 配置中有经理的凭据)。然后作业的控制台输出记录/var/lib/project/module/target/module.war 已部署到该 URL:
Deploying /var/lib/project/module/target/module.war to container Tomcat 7.x Remote with context
[/var/lib/project/module/target/module.war] is not deployed. Doing a fresh deployment.
Deploying [/var/lib/project/module/target/module.war]
我如何使用这个或另一个插件来部署在单独的 Jenkins 作业中制作的 WAR 工件?我希望有单独的工作来创建和部署工件。该插件没有找到 **/module-2.0.0-SNAPSHOT.war 甚至找不到由另一个作业构建的 **/module.war,即使磁盘上肯定有一个与该模式匹配的文件。
最佳答案
请参阅 Deploy Plugin's page 上的段落您链接:
How to rollback or redeploy a previous build
There may be several ways to accomplish this, but here is one suggested method:
- Install the Copy Artifact Plugin
- Create a new job that you will trigger manually only when needed
- Configure this job with a build parameter of type "Build selector for Copy Artifact", and a copy artifact build step using "Specified by build parameter" to select the build.
- Add a post-build action to deploy the artifact that was copied from the other job
Now when you trigger this job you can enter the build number (or use any other available selector) to select which build to redeploy. Thanks to Helge Taubert for this idea.
关于jenkins - 部署由另一个作业构建的 Jenkins 工件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47296544/