简体   繁体   English

如何在Jenkins中执行Liquibase脚本而不将liquibase插件安装为shell脚本

[英]How to Execute Liquibase script in Jenkins without installing liquibase plugins as shell scripts

We are using Liquibase 3.6.3 version 我们正在使用Liquibase 3.6.3版本

We are running SQL upgrade scripts using liquibase on the SQL Server Database using liquibase.bat(which we got as part of installation) as below on our local windows machines. 如下所示,我们在本地Windows计算机上使用liquibase.bat(作为安装的一部分获得)在SQL Server数据库上使用liquibase运行SQL升级脚本。 This is working as expected. 这正在按预期方式工作。

Command: 命令:

liquibase.bat --changeLogFile=..\\MasterChangelog.xml --driver==com.microsoft.sqlserver.jdbc.SQLServerDriver --classpath=sqljdbc4-3.0.jar --url="jdbc:sqlserver://;databaseName=MyDB;user=MyUser;password=MyPassword;" liquibase.bat --changeLogFile = .. \\ MasterChangelog.xml --driver == com.microsoft.sqlserver.jdbc.SQLServerDriver --classpath = sqljdbc4-3.0.jar --url =“ jdbc:sqlserver://; databaseName = MYDB;用户= MYUSER;密码= myPassword;复制代码” --logLevel=INFO update --logLevel = INFO更新

Now our requirement is to achieve the same through Jenkins as we are currently moving towards AWS. 现在,我们的要求是通过Jenkins实现与当前向AWS过渡相同的目标。

Questions: 问题:

• Do we have any supported liquibase plugins for Jenkins ? •我们是否有Jenkins支持的liquibase插件?

• Do we have any bash supported scripts something which will behave same as liquibase.bat •我们是否有任何bash支持的脚本,其行为与liquibase.bat相同

• Do we have any shell command snippets to execute liquibase scripts on Jenkins? •我们是否有任何Shell命令片段来在Jenkins上执行liquibase脚本?

• Any script snippets so that we can use them in Jenkins pipeline •任何脚本片段,以便我们可以在Jenkins管道中使用它们

Is there any other way of achieving this? 还有其他方法可以实现这一目标吗?

There is a liquibase shell script that ships with liquibase that is equivalent to liquibase.bat . liquibase附带有一个liquibase shell脚本,它等效于liquibase.bat

There is at least one Jenkins plugin for Liquibase - https://wiki.jenkins.io/display/JENKINS/Liquibase+Runner 至少有一个詹金斯插件Liquibase - https://wiki.jenkins.io/display/JENKINS/Liquibase+Runner

Seems to be this is working for me. 似乎这对我有用。

Windows: 视窗:

liquibase.bat --changeLogFile=..\\MasterChangelog.xml --driver==com.microsoft.sqlserver.jdbc.SQLServerDriver --classpath=sqljdbc4-3.0.jar --url="jdbc:sqlserver://;databaseName=MyDB;user=MyUser;password=MyPassword;" liquibase.bat --changeLogFile = .. \\ MasterChangelog.xml --driver == com.microsoft.sqlserver.jdbc.SQLServerDriver --classpath = sqljdbc4-3.0.jar --url =“ jdbc:sqlserver://; databaseName = MYDB;用户= MYUSER;密码= myPassword;复制代码” --logLevel=INFO update --logLevel = INFO更新

bash script: bash脚本:

./liquibase --changeLogFile=../MasterChangeLog.xml '--url=jdbc:sqlserver://MyDB;databaseName=MyDB;user=MyUser;password=MyPassword;' ./liquibase --changeLogFile = .. / MasterChangeLog.xml'--url = jdbc:sqlserver:// MyDB; databaseName = MyDB; user = MyUser; password = MyPassword;' --logLevel=INFO update --logLevel = INFO更新

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM