Contexts: Complex Only

We’re trying to sort out how to use Contexts and Labels and we can’t figure this one scenario out.

What we want is for a changeset to be applied only if two conditions are true. This logic gets us the closest: context:"@(EnvOne and EnvTwo)"

–contexts=“EnvOne” filters it out
–contexts=“EnvOne, EnvTwo” filters it in

But running with no contexts defined still includes it.

Simple uses of the only operator (ex: context:"@EnvOne") filter out changesets when no context is defined. So I’m wondering if it’s a bug with @(grouped_contexts)?


ps: we’re using Liquibase 4.25.0

1 Like

More info after some experimentation

This is what I was looking for. It’s fully exclusionary and won’t run if no contexts are defined at the CLI. This is required for it to run: –contexts=“Hello,World”

	context:"@Hello and @World"

This is fully exclusionary as long as long as any contexts are defined at the CLI, but it will run if no contexts at all are defined at the CLI.

	context:"@(Hello and World)"