Skip to content

cub changeset create

cub changeset create

Create a new changeset or bulk create changesets

Synopsis

Create a new changeset or bulk create multiple changesets by cloning existing ones.

SINGLE CHANGESET CREATION:

Create a changeset to bound and lock a change where it is made, such as several edits in a base. To promote the change, close the changeset and create a change order that ends at its end tag (cub changeorder create --end-tag /-end). The change order records the change in each space it is promoted into, so those spaces need no changeset of their own, unless their units are already in one that is still open, which the promotion then names with --changeset.

Examples:

  # Create a changeset
  cub changeset create --space my-space hotfix-changeset --description "Hotfix changes"

  # Create a changeset and ask alice to review it
  cub changeset create --space my-space hotfix-changeset --request-review alice

  # Create a changeset whose closing is gated by a ChangeWorkflow with no stages
  cub changeset create --space my-space hotfix-changeset --change-workflow platform/changeset-review

  # Create a changeset from JSON
  cub changeset create --space my-space -o json my-changeset --from-stdin < changeset.json

BULK CHANGESET CREATION:

When no positional arguments are provided, bulk create mode is activated. This mode clones existing changesets based on filters and creates multiple new changesets with optional modifications.

Bulk Create Examples:

  # Clone all changesets matching a pattern with name prefixes
  cub changeset create --where "Description LIKE '%release%'" --name-prefix archive- --dest-space archive-space

  # Clone specific changesets to multiple spaces
  cub changeset create --changeset my-changeset --dest-space dev-space,staging-space

  # Clone changesets using a where expression for destination spaces
  cub changeset create --where "Description LIKE 'Release%'" --where-space "Labels.Environment IN ('dev', 'staging')"

  # Clone changesets with modifications via JSON patch
  echo '{"Description": "Archived changeset"}' | cub changeset create --where "CreatedAt < '2024-01-01'" --name-prefix old- --from-stdin
cub changeset create [<slug> [--description <description>]] [flags]

Options

      --allow-exists                  Allow creation of resources that already exist
      --annotation strings            annotations in key=value format; can separate by commas and/or use multiple instances of the flag
      --change-workflow string        identifier (slug, space/slug, or UUID) of the ChangeWorkflow whose Final gates closing the changeset; it must have no stages, and cannot be changed later
      --changeset strings             target specific changesets by slug or UUID for bulk create (can be repeated or comma-separated)
      --delete-gate strings           delete gates in key[=true] format; can separate by commas and/or use multiple instances of the flag
      --description string            human-readable description of the change
      --dest-space strings            destination spaces for bulk create (can be repeated or comma-separated)
      --display-name string           friendly name for the entity, which need not be unique or URL-safe; an entity without one is shown by its slug
      --dry-run                       report what the command would write, and write nothing
      --filename string               Read the ConfigHub entity's fields, as YAML or JSON, from file, URL (https://), or stdin (-), as --from-stdin does; mutually exclusive with --from-stdin
      --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"
      --filter-space string           filter entity containing WHERE expression to select destination spaces for bulk create (slug or UUID)
      --from-stdin                    Read the ConfigHub entity's fields, as YAML or JSON, from stdin; merged with command arguments on create, and merged with command arguments and existing entity on update. A field the entity does not have, or one only the server sets, is refused; cub <entity> explain lists the fields
  -h, --help                          help for create
      --hidden-reason string          hide the entity, giving the reason as a name such as Retired: lists and bulk operations leave it out unless --include-hidden names the reason (use '-' to clear, which shows the entity again). Archived is not one a client sets: delete --archive archives an entity
      --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
      --label strings                 labels in key=value format; can separate by commas and/or use multiple instances of the flag
      --name-pattern string           a pattern string for name generation of clones, prefix 'template:' to use a Go template with .SourceEntitySlug to access the original ChangeSet and .Labels to access variant labels, example: 'template:{{.SourceEntitySlug}}-{{.Labels.env}}'
      --name-prefix strings           name prefixes for bulk create (can be repeated or comma-separated)
  -o, --output string                 Output format. One of: json, yaml, name, wide, mutations, jq=<expr>, yq=<expr>, custom-columns=<spec>
      --permission strings            permission in format Action:UserIDOrUsername, Action:group:GroupSlugOrID for a group you belong to, or Action:serviceaccount:ServiceAccountSlugOrID (e.g., Manage:user@example.com, View:group:platform, View:serviceaccount:deploy-bot, can be repeated)
      --quiet                         No default output.
      --request-review strings        ask a user (username or ID) to review the change set. Asking again re-requests the review (can be repeated or comma-separated)
      --variant-labels strings        labels for bulk create in the format of key1=value1|value2,key2=value1|value2|value3
      --verbose                       Detailed output, additive with default output
      --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
      --where-space string            where expression to select destination spaces for bulk create

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