部署由另一个作业构建的 Jenkins 工件
Deploying Jenkins Artifact Built by Another Job
我在我的 Jenkins
上安装了 Deploy Plugin
,以便将我的 Maven
构建的 war
包自动部署到 Tomcat 7
。问题是,只有当它们是在使用部署插件的同一作业中创建时,我才能使用插件部署到远程 Tomcat 服务器。换句话说,我无法设置部署由不同作业制作的工件的独立作业。
例如,我有一份名为pack.foo的工作。它使用 /var/lib/project/module 中的源代码创建 module.war 并将其放入 /var/lib/project/module/目标。但是,由于 Maven 版本设置,pack.foo 的工件页面上发布的工件类似于 module-2.0.0-SNAPSHOT.war。
我能够部署 module.war 的唯一方法是将 Post-build Action
添加到 pack.foo 并将 **/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
上安装了 Deploy Plugin
,以便将我的 Maven
构建的 war
包自动部署到 Tomcat 7
。问题是,只有当它们是在使用部署插件的同一作业中创建时,我才能使用插件部署到远程 Tomcat 服务器。换句话说,我无法设置部署由不同作业制作的工件的独立作业。
例如,我有一份名为pack.foo的工作。它使用 /var/lib/project/module 中的源代码创建 module.war 并将其放入 /var/lib/project/module/目标。但是,由于 Maven 版本设置,pack.foo 的工件页面上发布的工件类似于 module-2.0.0-SNAPSHOT.war。
我能够部署 module.war 的唯一方法是将 Post-build Action
添加到 pack.foo 并将 **/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.