Hi,
We having been using liquibase for our database refactoring using ant build/deployments through Jenkins on a Build Flow Plan. Build Flow plan would trigger another plan which invokes ant liquibase deployment. We haven't simplified it for a long time.
Now we are trying to simplify the same using one plan to deploy database changesets. We have been successfully able to load liquibase jar and ojdbc connector and invoke liquibase update but it doesnt do any changeset deployment. We tested using on empty database as well. But no success.
Following are the details.
Jenkins Workspace: /var/lib/jenkins/workspace/test_new_liquibase
Database Code Directory: /var/lib/jenkins/workspace/test_new_liquibase/_database_
Above folder have multiple folder structures representing individual schemas and has its changelog,xml
For example:
Schema Name: scott
Database Code Directory: /var/lib/jenkins/workspace/test_new_liquibase/_database_/scott
changelog file: /var/lib/jenkins/workspace/test_new_liquibase/_database_/scott/changelog.xml
We are doing following set of functions before invoking liquibase update method.
- liquibase.changelog.DatabaseChangeLog dc=new liquibase.changelog.DatabaseChangeLog("/var/lib/jenkins/workspace/test_new_liquibase/_database_/scott/changelog.xml")dc.setLogicalFilePath("/var/lib/jenkins/workspace/test_new_liquibase/_database_/scott")Connection con = DriverManager.getConnection("jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=${dbhost})(PORT=${dbport})))(CONNECT_DATA=(SERVICE_NAME=${dbservicename})))",dbusername,dbpassword);Liquibase lb = new Liquibase(dc,new liquibase.resource.FileSystemResourceAccessor(), database );liquibase.logging.LogFactory.getInstance().getLog().setLogLevel("debug");lb.update("");
Output:
Below output from Groovy Console in local machine
- DEBUG 7/12/17 7:11 PM: liquibase: Executing QUERY database command: select count(*) from scott.DATABASECHANGELOGLOCK
- DEBUG 7/12/17 7:11 PM: liquibase: Executing QUERY database command: select count(*) from scott.DATABASECHANGELOGLOCK
- DEBUG 7/12/17 7:11 PM: liquibase: Executing QUERY database command: SELECT LOCKED FROM scott.DATABASECHANGELOGLOCK WHERE ID=1 FOR UPDATE
- DEBUG 7/12/17 7:11 PM: liquibase: Lock Database
- DEBUG 7/12/17 7:11 PM: liquibase: Executing UPDATE database command: UPDATE scott.DATABASECHANGELOGLOCK SET LOCKED = 1, LOCKEDBY = 'PC0E28LT (10.210.224.249)', LOCKGRANTED = to_timestamp('2017-07-12 19:11:17.204', 'YYYY-MM-DD HH24:MI:SS.FF') WHERE ID = 1 AND LOCKED = 0
- INFO 7/12/17 7:11 PM: liquibase: Successfully acquired change log lock
- DEBUG 7/12/17 7:12 PM: liquibase: Computed checksum for 1499901137229 as 82ead9dfa9d935ffb948537fac940060
- DEBUG 7/12/17 7:12 PM: liquibase: Executing QUERY database command: SELECT MD5SUM FROM scott.DATABASECHANGELOG WHERE MD5SUM IS NOT NULL AND ROWNUM=1
- DEBUG 7/12/17 7:13 PM: liquibase: Executing QUERY database command: select count(*) from scott.DATABASECHANGELOG
- INFO 7/12/17 7:13 PM: liquibase: Reading from scott.DATABASECHANGELOG
- DEBUG 7/12/17 7:13 PM: liquibase: Executing QUERY database command: SELECT * FROM scott.DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
- DEBUG 7/12/17 7:16 PM: liquibase: Release Database Lock
- DEBUG 7/12/17 7:16 PM: liquibase: Executing UPDATE database command: UPDATE scott.DATABASECHANGELOGLOCK SET LOCKED = 0, LOCKEDBY = NULL, LOCKGRANTED = NULL WHERE ID = 1
- INFO 7/12/17 7:16 PM: liquibase: Successfully released change log lock
- DEBUG 7/12/17 7:16 PM: liquibase: Executing QUERY database command: select count(*) from scott.DATABASECHANGELOG
- INFO 7/12/17 7:16 PM: liquibase: Reading from scott.DATABASECHANGELOG
- DEBUG 7/12/17 7:16 PM: liquibase: Executing QUERY database command: SELECT * FROM scott.DATABASECHANGELOG ORDER BY DATEEXECUTED ASC, ORDEREXECUTED ASC
From Jenkins plan no debug messages.
Are we missing any steps?
Appreciate your time.
Thanks