简体   繁体   English

Jenkins:从artifactory部署war文件

[英]Jenkins: deploying war files from artifactory

We are using Jenkins to build ( maven ) & deploy artifacts (JARs & * WAR *s) to an in-house artifactory server (both snapshots and releases). 我们使用Jenkins构建( maven )并将工件(JAR和* WAR *)部署到内部工件服务器(快照和发布)。

For deployment, currently, we got Jenkins jobs that package the war file (from a release scm tag) and deploy to different environments/servers. 对于部署,目前,我们获得了Jenkins作业,它们打包war文件(来自发行版scm标记)并部署到不同的环境/服务器。 We want to skip the package phase as it seems unnecessary to package it again & again for a released version because it's not possible to get a different copy of war file even after trying 1000 times. 我们希望跳过包阶段,因为似乎没有必要再次打包它以及发布的版本,因为即使在尝试1000次之后也无法获得war文件的不同副本。

We are looking for a way in Jenkins to get the artifact (war) from Artifactory and deploy it to a container. 我们正在寻找Jenkins的方法从Artifactory获取工件(war)并将其部署到容器中。 I am sure other people would have faced this situation too but I am not able to find any online material regarding this. 我相信其他人也会遇到这种情况,但我无法找到任何有关此问题的在线资料。

Is there any Jenkins plugin that takes a war file from Artifactory (based on a version) and deploy it to a remote container? 是否有任何Jenkins插件从Artifactory(基于版本)获取war文件并将其部署到远程容器?

If this is not the right way of doing it then what are the recommendations for any other approach? 如果这不是正确的做法,那么对任何其他方法的建议是什么?

Thanks 谢谢

I don't know about a plugin which takes a version # and deploys that, but you can build a Jenkins job to deploy the last successful release to a previous environment (thus copying from DEV-->QA for example.) 我不知道一个带有版本#并部署它的插件,但你可以构建一个Jenkins作业,将最后一个成功的版本部署到以前的环境(例如从DEV - > QA复制。)

To do this, you would use the copy-artifact-plugin. 为此,您将使用copy-artifact-plugin。

Here's an easy to follow run-through of this kind of setup: 这是一种易于遵循的这种设置:

http://www.lordofthejars.com/2012/09/deploying-jee-artifacts-with-jenkins.html http://www.lordofthejars.com/2012/09/deploying-jee-artifacts-with-jenkins.html

Every artifact stored in Artifactory will have a unique URL that includes the version number. 存储在Artifactory中的每个工件都将具有包含版本号的唯一URL。 It will take the format 它将采用这种格式

http://artifactory-server/repository-name/path-to-artifact/version/filename

eg 例如

http://artifactory/apps-releases-local/com/yourorg/yourapp/1.5.67/webapp.war

(depending on how you do your packaging, the WAR file name may include the version number as well). (取决于您的打包方式,WAR文件名也可能包含版本号)。

So your deployment job can construct the Artifactory URL and download the file. 因此,您的部署作业可以构建Artifactory URL并下载该文件。 Depending on how you have security set up in Artifactory, you may need to authenticate the request. 根据您在Artifactory中设置安全性的方式,您可能需要对请求进行身份验证。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM