How To: Skip Jenkins Build Jobs when Liquibase Commits

Problem:

It is common for customers to configure Jenkins to automatically run a build job whenever changes are committed to the SQL Repo. However, the Liquibase Packager operation also commits changes back to the SQL repo upon a successful build. The commits by Liquibase should not trigger a second build job.

Solution:

Liquibase provides an option to specify a custom commit prefix when Liquibase commits changes to the SQL Repo.  Add it to the hammer command when running Packager.

hammer groovy deployPackager.groovy pipeline=current commitPrefix="[skip ci]" scm=true labels=$(Build.BuildId)

 

Next configure your CI build trigger to skip commits which contain the special message.  Check your Jenkins documentation for the options you have available. You may need to install a Plugin to perform this task. 

Additional information can be found:

https://plugins.jenkins.io/scmskip/

https://docs.cloudbees.com/docs/cloudbees-codeship/latest/general-projects/skipping-builds

 

Copyright © Datical 2012-2020 - Proprietary and Confidential