cub variant revert
cub variant revert
Take back a change across the units it made, keeping what came after it
Synopsis
Take back a change in every unit it made, with a new revision of each, keeping the changes made since.
What to revert is one change, or a range of revisions:
7 revision 7
ChangeSet:
Each end is a revision as --restore takes one: a number, HeadRevisionNum,
LastReleasedRevisionNum, Tag:
A range whose ends resolve the wrong way round on a unit, such as two tags named in the wrong order, is refused rather than re-applied.
A revert writes one new revision that takes back what the reverted revisions changed, and keeps everything done since, as git revert does. It is a merge of the unit with its own history with the range reversed ("cub unit update --merge-source Self --squash"), so a path changed again since keeps the later value only where the two do not touch. To go back to an earlier revision outright, dropping everything after it, restore it instead ("cub unit update --restore").
A revert is cleared for Override guards, since it takes back the unit's own change. A path held by any other guard is left as it is and reported as a conflict, with the --clearance that would take it.
A change order is undone with "cub variant demote", which restores each space it reached and records that it did.
The units are those the change marks: the units a changeset, tag or release marks -- the end of a range, or its start when the end is HeadRevisionNum or LastReleasedRevisionNum -- in the variant when one is named, and wherever they are otherwise. A range with nothing but those two at its ends, such as LastReleasedRevisionNum..HeadRevisionNum, marks no units, so it needs a variant, and reverts every unit of it. --where narrows the units. Revision numbers differ from unit to unit, so they are not accepted here; "cub unit revert" takes them.
A unit the change marks but did not change gets no new revision.
Without --change-desc, each new revision is described by what it reverted in that unit, as "Reverted revisions 6-7", or for a changeset by the changeset and its description.
Publishing is separate: "cub release publish" takes the new revisions to a cluster.
Examples:
# Revert a changeset everywhere it made changes, showing what that would do first
cub variant revert ChangeSet:web-base/tls-rollout --dry-run -o mutations
cub variant revert ChangeSet:web-base/tls-rollout
# Revert what was done between two tags in one variant
cub variant revert web/prod Tag:web-prod/pre-tls..Tag:web-prod/post-tls
# Revert everything since a tag, in the workloads only
cub variant revert web/prod Tag:web-prod/pre-tls..HeadRevisionNum --where "Slug LIKE 'deployment-%'"
# Revert every unreleased change in a variant
cub variant revert web/dev LastReleasedRevisionNum..HeadRevisionNum
cub variant revert [<variant>] <revisions> [flags]
Options
--change-desc string change description recorded on the new revisions; by default, what they reverted
--changeset string open changeset to record the new revisions in
--clearance stringArray class of guarded reason this change is cleared for, as KEY, KEY=VALUE[;VALUE...], KEY!=VALUE[;VALUE...], or !KEY to refuse any path carrying KEY (repeatable). A guarded path this does not cover is not written, and the withheld change is reported as a conflict. A revert is cleared for Override guards without it, since it takes back the unit's own change
--dry-run report what the command would write, and write nothing
--fail-on-timeout exit with status 4 rather than 0 when the wait for Triggers runs out before they finish, or cannot read a unit to tell. The changes are saved either way, so do not make them again
-h, --help help for revert
--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 but Archived when given no value or "*". ConfigHub/YAML Units, which hold the configuration of other entities, are hidden with the reason BackingUnit. Archived entities are selected only when the reasons name Archived, as in --include-hidden=Archived or --include-hidden='*,Archived'. A --where naming entities by Slug or ID lists them whether hidden or not, but a bulk operation acts on archived ones only when --include-hidden names Archived
-o, --output string Output format. One of: json, yaml, name, wide, mutations, jq=<expr>, yq=<expr>, custom-columns=<spec>
--quiet No default output.
--timeout duration how long to wait for the Triggers of the units the command writes, as a duration such as 30s or 2m. The changes are saved whether or not the Triggers finish in time; when they do not, the command names the units and exits 0, unless --fail-on-timeout (default 2m0s)
--verbose Detailed output, additive with default output
--wait wait for the Triggers of the units the command writes to finish (default true)
--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]+$'". 'cub <entity> explain --where' lists the attributes an entity's expressions can name
Options inherited from parent commands
--context string The context to use for this command
--debug Debug output
SEE ALSO
- cub variant - Variant commands