cub changeworkflow create
cub changeworkflow create
Create a new ChangeWorkflow Unit or bulk create ChangeWorkflow Units
Synopsis
Create a Unit holding a ChangeWorkflow definition, or bulk create ChangeWorkflow Units by cloning existing ones.
SINGLE CHANGEWORKFLOW CREATION:
A ChangeWorkflow says how a change is promoted: the ordered stages it moves through, which Spaces each stage selects, and the gates that have to pass before it enters one. The definition is a YAML document, and this command creates the Kubernetes/YAML Unit that holds it, from a file or from flags.
A stage selects its Spaces with a "whereSpace" expression over Space labels. It must not name
Labels.Component: the component is the change order's own and is appended to every stage's
selector, which is what lets one definition be cloned to give another component the same shape
of rollout. A stage named with --stage selects "Labels.Stage = '
The gates a stage can declare are: released every Space of the stage ahead has published a Release carrying the change healthy every Space of the stage ahead reports it Synced, Succeeded and Healthy
--prerequisites is one set of gates, given to every stage and to the final stage alike. A stage's gates are its entry gates: they are checked over the stage before it, so the first stage's are never evaluated. The final stage's are what the last stage must satisfy for the rollout to read as completed, which no promotion can gate because no hop is left. A rollout whose stages gate differently from one another is written as a definition file.
Single Examples:
# From a file, or from stdin with "-"
cub changeworkflow create --space workflows myapp-main-line workflow.yaml
# From flags. Each --stage names one stage, given in the order a change is promoted through
# them, and --prerequisites gates every one of them alike.
cub changeworkflow create --space workflows myapp-main-line \
--stage dev --stage staging --stage prod \
--prerequisites released,healthy
# Then create a change order governed by it
cub changeorder create --space myapp-base bump-base-image \
--change-workflow workflows/myapp-main-line
BULK CHANGEWORKFLOW CREATION:
When no positional arguments are provided, bulk create mode is activated. This mode clones existing ChangeWorkflow Units and creates multiple new ones with optional modifications. Only Units of the Kubernetes/YAML toolchain are selected, since that is what a definition is held as.
A clone carries the definition as it stands, metadata.name included, so a clone still names the workflow it was cloned from. That name is what promotions and "cub changeorder get" report the workflow as; change it with "cub unit update" where it matters.
Bulk Create Examples:
# Give every team's workflow space a copy of the standard rollout
cub changeworkflow create --changeworkflow myapp-main-line \
--dest-space payments-workflows,search-workflows
# Clone the workflows of one space into every space a where expression selects
cub changeworkflow create --space workflows --where "Slug LIKE '%-main-line'" \
--where-space "Labels.Kind = 'workflows'"
# Clone with a name prefix, and label the clones
cub changeworkflow create --changeworkflow myapp-main-line \
--dest-space workflows --name-prefix canary- --label "Rollout=canary"
# Clone with modifications via JSON merge patch
echo '{"DisplayName": "Standard rollout"}' | cub changeworkflow create \
--changeworkflow myapp-main-line --dest-space workflows --name-prefix std- --from-stdin
cub changeworkflow create [<slug> [<definition-file>]] [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-desc string change description recorded on the revision the definition is written as
--changeworkflow strings target specific ChangeWorkflow Units 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
--dest-space strings destination spaces for bulk create (can be repeated or comma-separated)
--filename string Read the ConfigHub entity JSON from file, URL (https://), or stdin (-); 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 JSON (e.g., retrieved with cub <entity> get --quiet --json) from stdin; merged with command arguments on create, and merged with command arguments and existing entity on update
-h, --help help for create
--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 Unit 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>
--prerequisites strings gates given to every stage and to the final stage (can be repeated or comma-separated): released, healthy. A stage's gates are checked over every Space of the stage ahead of it, so the first stage's are never evaluated
--quiet No default output.
--stage strings name of one stage of the workflow (can be repeated or comma-separated), given in the order a change is promoted through them. A stage selects the Spaces labeled "Labels.Stage = '<name>'", which is what "cub variant create --stage" sets; a stage selecting its Spaces some other way is written as a definition file
--timeout string completion timeout as a duration with units, such as 10s or 2m (default "10m0s")
--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
--wait wait for completion (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]+$'"
--where-space string where expression to select destination spaces for bulk create
Options inherited from parent commands
--context string The context to use for this command
--debug Debug output
--space string space ID to perform command on
SEE ALSO
- cub changeworkflow - ChangeWorkflow commands