cub variant diff
cub variant diff
Show differences in a Variant between Tags
Synopsis
Show what changed across a whole variant space between two Tags.
A Tag marks one Revision in each Unit it was applied to, so naming two Tags compares the space at two points in its history -- the state one release captured against the state another did -- rather than one Unit at a time. Each Unit is diffed from its Revision on the one side to its Revision on the other, and Units whose configuration is the same at both print nothing.
Each side has to name something that picks out a Revision in every Unit of the space:
A Unit with no Revision carrying the Tag is absent on that side rather than falling back
to its head, so it shows as a whole addition or removal and is labeled "absent". That is
where this differs from cub release publish --revision, which selects the same
Revision but has to bundle something for every Unit, and so falls back.
A revision number, a delta from head, a Revision ID and LastReleasedRevisionNum each pick
out a Revision of one Unit, and mean something different -- or nothing -- in the next one,
so they are refused here; cub unit diff is what takes them. Slugs resolve in
--where narrows the Units compared, taking the same expressions cub unit list
does.
Output Formats: - Default: Line-numbered format with color, under a header naming each Unit - Unified: Use -u for unified diff format (like git diff) - Color: Use -c to enable color in unified diff - Mutations: Use -o mutations for a structured diff
-o mutations shows, for each Unit, the paths that differ with the value on each side, rather than the lines that differ. List elements are matched by merge key -- containers and environment variables by name -- as a merge matches them, so an element inserted ahead of others is one addition rather than a change to every element after it. The whole space is diffed by the server in one request. A Unit absent from one side shows as whole resources added or removed.
Examples:
# What the variant has changed since the release tagged v1.3.0
cub variant diff apptique-prod v1.3.0
# Between two releases
cub variant diff apptique-prod v1.2.0 v1.3.0
# What a change order brought to the variant
cub variant diff apptique-prod Before:ChangeOrder:release-42 ChangeOrder:release-42
# Only the workloads, as a unified diff
cub variant diff -u apptique-prod v1.2.0 v1.3.0 --where "Slug LIKE 'deployment-%'"
# Each changed path with its value on both sides, rather than the lines
cub variant diff apptique-prod v1.2.0 v1.3.0 -o mutations
# The same, with the unchanged fields around each change
cub variant diff apptique-prod v1.2.0 v1.3.0 -o mutations --diff-context
cub variant diff <variant> <fromTag> [toTag] [flags]
Options
-c, --color colorize the unified diff output (default: true for numbered diff)
--diff-context with -o mutations, also show the unchanged paths around each change: every unchanged field and element of each map and list a change is in, up to the resource
-h, --help help for diff
--include-hidden string[="*"] Also select hidden entities, to list or to act on: those hidden for the given HiddenReasons, comma-separated, as in --include-hidden=BackingUnit, or for any reason when given no value or "*". ConfigHub/YAML Units, which hold the configuration of other entities, are hidden with the reason BackingUnit. A --where naming entities by Slug or ID selects them whether hidden or not
-o, --output string Output format: "default" for the text diff, or "mutations" for a structured, path-by-path diff that matches list elements by merge key.
--quiet No default output.
-u, --unified output unified diff format
--where string Filter expression using SQL-inspired syntax. Supports conjunctions with AND. String operators: =, !=, <, >, <=, >=, LIKE, NOT LIKE, ILIKE, ~~, !~~, ~, ~*, !~, !~*. Pattern matching with LIKE/ILIKE uses % and _ wildcards. Regex operators (~, ~*, !~, !~*) support POSIX regular expressions. A related entity is referenced by prefix, as in "UpstreamUnit.Slug = 'base'"; when the reference names a list, a * segment matches any element, as in "FromLink.*.Slug = 'upgrade-app'". Examples: "Slug LIKE 'app-%'", "DisplayName ILIKE '%backend%'", "Slug ~ '^[a-z]+-[0-9]+$'"
Options inherited from parent commands
--context string The context to use for this command
--debug Debug output
SEE ALSO
- cub variant - Variant commands