Search code examples
mavenazure-devopsliquibase

Run Liquibase with Azure CICD pipeline


I want to run my Database updates with liquibase commands. I have added all the required details and configured the liquibase.properties files in my project. Everything works fine with local deployments. Now I am using Azure CICD pipeline to deploy the code into my higher environments.

I want to run mvn liquibase:update -Pdev command from the pipeline. When I run this as a maven task in azure-pipelines.yml, I get "liquibase.exception.DatabaseException: Connection could not be created to jdbc:postgresql: ...etc".

How I can run the mvn liquibase commands with the pipeline? I do not have persmission to allow CICD server to access the DB server directly. Any alternative mechanism also would be helpful.


Solution

  • I was able to resolve this by granting some access to the pipeline in the Azure environment. I had to change an NSG(network security group) rule so that the Azure build servers (VMSS) could reach the database (postgress DB) over port 5432 in each environment.