Skip to content

cub draft create

cub draft create

Clone units of a space into a draft space

Synopsis

Create a draft of a space: clone its units, or those --where selects among them, into a new space named -draft-, with a syncback link from each original unit to its clone, so the changes made in the draft can be landed in the original units.

The draft space is a clone of the original: it is in the same Component and has the same labels, except that its Stage label is Draft, its Draft label is , and its Variant label is -draft-. It selects the Triggers the original selects, so validation and mutation run in the draft as they do in the original. It has no release target, so releasing it cannot publish to where the original's releases go, unless --release-target gives it one for a preview deployment.

Links between the cloned units are copied and retargeted at the clones. A cloned unit's links to units that were not cloned are copied too, still pointing at those units, so a clone reads from the same producers its original does. The original units' own upgrade links, and the syncback links of other drafts, are not copied.

A draft that has landed keeps its change set, draft-, in the original space, as the record of the change, so its name cannot be used for another draft of that space.

A change order of the original space's changes that is not told where it is headed is headed for the draft too, like any clone. Leave drafts out by their labels: create it with --component and --where-space-field "Labels.Stage != 'Draft'", or with the stages it is meant for.

Examples:

  # Draft a change to the deployment of acme-base.
  cub draft create acme-base raise-web-memory --where "Slug = 'deployment'"
  cub function set --space acme-base-draft-raise-web-memory --unit deployment \
      set-container-resources web all "" 1Gi 1

  # Draft a change to every unit of a variant, and deploy the draft as a preview.
  cub draft create acme/dev new-ingress --release-target preview/cluster
cub draft create <space> <name> [flags]

Options

      --change-desc string            change description recorded on each clone's first revision
      --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 create
      --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.
      --release-target string         Target to give the draft space as its release Target, for a preview deployment, addressed as <target-space>/<target-slug> or a Target ID
      --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 draft - Draft a change to a space in a space of its own, then land it