'Liquibase exclude any changesets without a label
Is it possible to prevent changesets without a label from being deployed?
We want to deploy our changesets based on feature/ticket using liquibase labels. However, we have a lot of existing changesets without labels and many developers creating new changesets without labels as well. Typically this is fine and we just deploy the entire code base at the same time.
However sometimes we have specific features that we want to deploy separately. Labels seem to be the answer but I see that any changsets without a label will also be deployed. Rather than go through and label existing changesets it would be nice if we could deploy only changesets with matching labels and ignore non-labeled changesets.
Here is an example of our typical changset
--changeset team/domain/repo:1 runOnChange:true labels:"ABCD-1234"
drop procedure if exists schema.procedure();
//
create procedure schema.procedure();
...
There is more to the changeset, but limiting it only to what's necessary.
Then the liquibase command is run with a defaultsFile with the following property:
labels: "ABCD-1234"
So, is it possible to somehow tell liquibase to only deploy changesets with a label?
Solution 1:[1]
You might be able to accomplish this by using contexts instead of labels. Managing changesets that load test data is a common use case in Liquibase. You want changesets that load test data to run in your development and QA environments, but you don’t want them to run in production. Both labels and contexts will allow you to do this. The linked article contains examples of how this can be used and what the best practices are.
References:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | tabbyfoo |