changeset

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 29, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package changeset wraps the cub changeset CLI for installer use: per-Space ChangeSets opened by `installer update` so the resulting updates can be reverted as a unit.

Note on revert scope (per docs/lifecycle.md): only update mutations recorded against the ChangeSet are revertable via `cub unit update --restore Before:ChangeSet:<slug>`. Creates and deletes are not reverted by ChangeSet restore — to undo a create, delete the Unit; to undo a delete, re-render and re-run `installer update`.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultSlug

func DefaultSlug(t time.Time) string

DefaultSlug returns the conventional slug for an installer update ChangeSet at the given time. Stable input → stable output (no nondeterminism); callers wanting the live timestamp pass time.Now().

Format: installer-update-YYYYMMDD-HHMMSS (UTC). Avoids RFC3339's colons and timezone offsets that ConfigHub slug rules disallow.

func Open

func Open(ctx context.Context, space, slug, description string) (string, error)

Open creates a ChangeSet in space with the given slug and description. Idempotent via --allow-exists: if a ChangeSet with the same slug already exists in the Space, Open returns the same slug without erroring. The caller is responsible for choosing a slug that's stable across retries (DefaultSlug is — within the same second).

func RestoreCommand

func RestoreCommand(space, slug string, updatedSlugs []string) string

RestoreCommand returns the verbatim shell command an operator can run to revert the updates this ChangeSet captured. updatedSlugs is the exact set of Units modified during the update — scoping the restore to those slugs avoids partial-failure noise when other Units share the Component label but were not part of this ChangeSet. Uses --patch because bulk restore requires it.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL