Jenkins: deploying war files from artifactory

柔情痞子 提交于 2019-12-22 03:43:44

问题


We are using Jenkins to build (maven) & deploy artifacts (JARs & *WAR*s) to an in-house artifactory server (both snapshots and releases).

For deployment, currently, we got Jenkins jobs that package the war file (from a release scm tag) and deploy to different environments/servers. 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.

We are looking for a way in Jenkins to get the artifact (war) from Artifactory and deploy it to a container. 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?

If this is not the right way of doing it then what are the recommendations for any other approach?

Thanks


回答1:


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.)

To do this, you would use the 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




回答2:


Every artifact stored in Artifactory will have a unique URL that includes the version number. It will take the format

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

e.g.

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).

So your deployment job can construct the Artifactory URL and download the file. Depending on how you have security set up in Artifactory, you may need to authenticate the request.



来源:https://stackoverflow.com/questions/22869402/jenkins-deploying-war-files-from-artifactory

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!