I am seeing that if no contexts switch is present in the calling command, all changesets with any context are run. I would like to
- enforce that a context has been submitted to the liquibase command
- print what context was submitted
Any ideas?
I am seeing that if no contexts switch is present in the calling command, all changesets with any context are run. I would like to
Any ideas?
@JamesContractor How are you calling Liquibase?
hey james
Are you familiar with liquibase quality checks or liquibase flow?
the first question is really just using the ChangesetContextCheck QC and setting the severity/return code to whatever level stops your automation job.
ideally you would run QCs as part of a flow, so the checks are enforced every time, but you could run QCs by themselves too.
as for number 2, there isnt a liquibase way to print out all the contexts. they ARE stored in teh DBCL, but there isnt a liquibase native “print contexts from DBCL” or something like that.
that said, since you can run shell scripts from flow, you could whip one up that queries the DBCL (or the text of the changelog) for that data. it would be an exercise left to the reader to wrangle permissions for DB access, or to parse through the changelog text to match for contexts, etc.
hope this leads you closer to where you need to be!
cheers,
mario
As a side note… The documentation page for using contexts does not have the proper syntax.
“contextFilter” does not seem to work:
–changeset bob:1 contextFilter:test
“context” does work:
–changeset bob:1 context:test
Thanks for your suggestions. If we had Pro we would have used flow. We ended up storing the context in the database so we could refer to it for certain configurations, and then using a preCondition to check that only one is set, like so:
databaseChangeLog: