Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 854
Rehan Avatar asked Apr 04 '14 17:04

Rehan


2 Answers

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

like image 187
Chris Giddings Avatar answered Nov 07 '22 08:11

Chris Giddings


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.

like image 37
gareth_bowles Avatar answered Nov 07 '22 08:11

gareth_bowles