Jenkins: deploying war files from artifactory

2019-04-20 02:32发布

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

2条回答
欢心
2楼-- · 2019-04-20 03:14

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

查看更多
萌系小妹纸
3楼-- · 2019-04-20 03:22

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.

查看更多
登录 后发表回答