cub release publish
cub release publish
Publish a release
Synopsis
Publish a Release for the Space's release Target, bundling the Units in
cub space create or cub space update.
By default each bundled Unit is captured at its head Revision. Pass --revision to instead pin each Unit to the highest-numbered Revision carrying a Tag. A Unit the Tag marks no Revision of is left out of the Release, and listed as skipped, when it has never been released; once a Unit has been released, the Tag has to mark one of its Revisions, since leaving it out would delete it from the Target.
Each Unit's Revision is selected by Tag, so what --revision names has to come down to one Tag. A Tag does; so do the boundaries of a ChangeSet and a ChangeOrder, which is how a whole change is released rather than a Revision number that means something different in every Unit:
--revision
Each of them is refused for a Unit released since at a later Revision, since a Release never rolls a Unit back (below).
A ChangeOrder's release tag marks every releasable Unit of each Space the change is in, at the state the change left it in, and follows what resolving Links within the Space writes after the promotion. Publishing by ChangeOrder publishes for that ChangeOrder: its release prerequisites are checked against what is bundled, and its stage is advanced. Move the release tag to adopt a later Revision of a Unit before releasing with "cub unit tag --move". Where a Unit has been released past the Revision the release tag marks, as when another change order promoted into the Space after this one was released first, publishing moves the release tag up to the released Revision, so that the Release carries the other change rather than rolling it back.
A Release never rolls a Unit back: publishing is refused when the Revision it
would bundle for a Unit is older than the Unit's LastReleasedRevisionNum. To
roll back, restore the earlier configuration as a new Revision, with
"cub unit update --patch --restore Before:ChangeOrder:
A Release of a ChangeOrder can carry revisions from before the change: a unit's revisions after its last released one, up to where the change starts, which an earlier change promoted on from this Space without releasing it here. --prior-revisions Error refuses such a Release, naming them and the change orders they belong to; Include, the default, releases them.
--dry-run publishes in a transaction that is rolled back, reporting the Release that would be published or why it would be refused.
Publishing changes what the release Target's cluster runs, so it requires
TargetEditChildren permission on
A publish is refused when a bundled Unit has outstanding ValidationErrors on the Revision it would bundle, or when that Revision is part of a ChangeSet that has not closed or is not where the ChangeSet ended. It is also refused when the Component requires a ChangeWorkflow and the Release is not of a ChangeOrder that has one (for a ChangeOrder, the Component of the ChangeOrder's Space). --dry-run reports why.
A revision number, a Revision ID and the named revisions each pick out a Revision of one Unit, so they are not accepted. Slugs resolve like any other entity slug: in --space, or across the organization when there is none, unless qualified as space/slug.
--label, --annotation and --delete-gate set the Release's metadata at publish
time; cub release update can change it afterwards. The bundled content
itself is fixed once published, and so is --bundle-base-name: the release's OCI
manifest records the name, so it can only be set here.
Publishing a Space that is unchanged since its latest published Release succeeds without creating a Release, and reports "No change".
A Release that would bundle no Units is refused when the Space's latest published Release bundles some: a GitOps controller pulling the Space deletes everything the previous Release deployed, and reports success.
Examples:
cub release publish my-space
# Bundle each Unit at the Revision tagged "v1.2.0"
cub release publish --revision v1.2.0 my-space
# Bundle each Unit at the Revision a closed ChangeSet ended on
cub release publish --revision ChangeSet:rollout-42 my-space
# Release a change order, after checking what would be released
cub release publish --revision ChangeOrder:bump-base-image --dry-run my-space
cub release publish --revision ChangeOrder:bump-base-image my-space
# Roll a released change order back: restore what preceded it, and release that
cub unit update --patch --space my-space --restore Before:ChangeOrder:bump-base-image
cub release publish my-space
# Publish with metadata, and a gate that blocks deleting the Release
cub release publish --label env=prod --annotation ticket=OPS-1234 my-space
cub release publish --delete-gate retention/30-days my-space
cub release publish <variant> [flags]
Options
--annotation strings annotations in key=value format; can separate by commas and/or use multiple instances of the flag
--bundle-base-name string base filename for the release's stored bundle, without the .tar.gz suffix; defaults to the bundled Unit's slug for a single-Unit release and to the Space's slug otherwise
--delete-gate strings delete gates in key[=true] format; can separate by commas and/or use multiple instances of the flag
--dry-run publish in a transaction that is rolled back: report the release that would be published, or why it would be refused, including a change order's release prerequisites, and publish nothing
-h, --help help for publish
--label strings labels in key=value format; can separate by commas and/or use multiple instances of the flag
-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)
--prior-revisions string with --revision ChangeOrder:<slug>, what to do with a unit's revisions from before the change -- after its last released revision, up to where the change starts: Include releases them; Error refuses, naming them and the change orders they belong to. Defaults to the change order's ReleasePriorRevisions
--quiet No default output.
--revision string Which tagged Revision to bundle for each Unit, as a Tag (slug, Tag:slug, space/slug or Tag ID) or as a ChangeSet:slug or ChangeOrder:slug boundary, optionally prefixed with Before:. A Unit without a matching tagged Revision is skipped if it has never been released, and refused otherwise.
--verbose Detailed output, additive with default output
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
- cub release - Release commands