Skip to content

continuous deployment semi automated

Matthieu Brouillard edited this page Jan 6, 2017 · 3 revisions

Continuous deployment using jenkins & multibranch pipeline

One possible solution to start auto-deploying your project is just to use mvn deploy instead of mvn install.

Starting from the Jenkinsfile in the demo project, replace the stage('Local installation') part with

stage('Deployment')
if (isUnix()) {
    sh "${mvnHome}/bin/mvn -DskipTests deploy"
} else {
    bat "${mvnHome}\\bin\\mvn -DskipTests deploy"
}

This first change will automatically deploy all commits on all your project' branches if you setup a job like explained in the jenkins-integration-multibranch-pipeline.

How to release the project?

Using this simple setup, it is possible to deploy released version of your project using few steps.

If we consider that we release only on the master branch of the project (like all jgitver projects) then using the above setup you are only few steps away a semi automatic deployment.

Once your are satisfied of a commit on the master branch (probably after a FF merge from a topic branch):

  • tag the HEAD of master: git tag -a -m "this is release X.Y.Z" X.Y.Z

  • push the tag to your remote: git push --follow-tags origin master

  • force a build of the master branch:

    any of the above will make a build of the master branch on which the annotated tag X.Y.Z is set, and thus will lead in a build/deployment of your project version X.Y.Z

Advantages/drawbacks

👍

  • easy to setup
  • keeps the git history clean

👎

  • some manual steps