Reputation: 11682
I have recently started using jenkins for continuous integration of my project. It builds a WAR file (using Maven) and an Android app (using Ant). I also want to automate the deployment of a nightly build of the WAR onto my Tomcat test server and a deployment of my Android app to a webserver so it can be installed over the air. One way to do this is to add an ant build target for this release distribution, and have Jenkins call this ant taget.
My question is, is this appropriate use of Jenkins or should I have a separate process for this release distribution (e.g. a cron job calling the ant target)?
Upvotes: 3
Views: 7078
Reputation: 657
You should defintively use Jenkins for this. There is a deploy-plugin which works for Tomcat among other servers. Configure is as a post-build action and it will deploy your war file to a specific Tomcat instance. You can choose to only redeploy the web app if all tests has passed etcetera.
I wrote a guide on this here http://macgyverdev.blogspot.se/2014/02/how-to-make-jenkins-install-packaged.html
Upvotes: 1
Reputation: 8100
If you have an ant target able to publish your .war
file to Tomcat as well as your Android app to your webserver already, you can create a job (or two) inside Jenkins to perform these tasks, and then use the "Build Periodically" option in Jenkins to only build these jobs at specified times.
The "Build Periodically" box uses cron
-style time definitions.
# min hour day-of-month month day-of-week
# Some examples:
# Run this job at 4 am daily
0 4 * * *
# Run this job at midnight daily
@midnight
# Run this job every Sunday at 3pm
0 15 * * 0
# or (Note: Sunday == day-of-week 0 and 7)
0 15 * * 7
For more decent cron
examples, check out this example
Upvotes: 1
Reputation: 78021
Here's an article to read with good advice on running deployments from a CI server like Jenkins:
http://decodify.blogspot.com/2010/10/how-to-build-one-click-deployment-job.html
Upvotes: 2