Skip to content

cub unit tag

cub unit tag

Add or remove tags to/from unit revisions (supports space/tag syntax)

Synopsis

Add or remove tags to/from unit revisions using bulk operations.

This command allows you to tag specific revisions of units with a tag identifier. Use bulk selection options to tag multiple units at once.

Tag a specific revision type:

  --revision HeadRevisionNum     Tag the head revision (default)
  --revision LastReleasedRevisionNum  Tag the last released revision
  --revision 42                  Tag revision 42
  --revision Tag:release-v1      Tag the revision another tag marks
  --revision ChangeSet:rollout   Tag the revision a changeset ended on
  --revision Before:Tag:release-v1  Tag the revision before another tag's
  --revision Remove              Remove the tag from the revision
  --revision -                   Remove the tag (shorthand for Remove)

--move moves the tag from the revision it marks on each selected unit to the revision named, and refuses a unit it marks no revision of. Tags a changeset, a change order or a release made cannot be added or removed; a change order's release tag, named as ChangeOrder:, can be moved, to adopt a revision made after the promotion before the change is released. It cannot move to a revision before the one the change order's end tag marks or the unit's last released revision, to one with validation errors, or at all in a space where a release has been published at it.

Examples:

  # Tag head revision of a single unit
  cub unit tag --space my-space my-tag --unit my-unit

  # Tag the last released revision of all units with specific label
  cub unit tag --space my-space release-v1 --revision LastReleasedRevisionNum --where "Labels.version = 'v1'"

  # Tag whatever revision a changeset ended on, across the units it touched
  cub unit tag release-v1 --revision ChangeSet:rollout --where "Space.Slug = 'prod'"

  # Remove tag from units
  cub unit tag --space my-space my-tag --revision Remove --unit my-unit,another-unit

  # Remove tag using shorthand
  cub unit tag --space my-space my-tag --revision - --where "Labels.cleanup = 'true'"

  # Tag units across all spaces with space/tag syntax
  cub unit tag production/prod-release --where "Labels.env = 'production'"

  # Use space/tag syntax to target tag in specific space
  cub unit tag dev-space/dev-tag --unit my-unit

  # Release a fix made in review with a change order: move its release tag to the fixed revision
  cub unit tag ChangeOrder:base/bump-image --move --revision HeadRevisionNum --space staging --unit web
cub unit tag <tag-slug-or-id> [flags]

Options

      --filter string                 Filter entity to apply to the list. Specify as 'space/filter' for cross-space filters or just 'filter' for current space. Supports both slugs and UUIDs. The filter will be combined with any --where clause using AND logic. Examples: "production-filters/security-check", "my-filter-uuid", "validation-rules"
  -h, --help                          help for tag
      --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
      --move                          move the tag from the revision it marks on each unit to --revision, refusing a unit it marks no revision of; the only way to move a change order's release tag (ChangeOrder:slug)
      --revision string               Which revision to tag: a named revision (HeadRevisionNum, LastReleasedRevisionNum), a revision number, a tag slug, Tag:slug, ChangeSet:slug, ChangeOrder:slug, any of those prefixed with Before:, or Remove (-) to remove the tag (default "HeadRevisionNum")
      --unit strings                  target specific units by slug or UUID for bulk tag (can be repeated or comma-separated)
      --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

      --component string   the Component of --variant, when that names the variant alone; --variant <component>/<variant> says the same in one flag
      --context string     The context to use for this command
      --debug              Debug output
      --space string       space to operate in, by slug or UUID. Omitted, a list or bulk operation spans the organization and a single entity is named as <space>/<slug>; "*" means the same as omitting it
      --variant string     variant to operate in, as <component>/<variant>, or as <variant> with --component: the space naming that Component whose Variant label is <variant>. The same scope as --space, named by what it is rather than by the space's slug; the two cannot be combined

SEE ALSO