Documentation
¶
Index ¶
- func BuildChangelogPipeline(runner port.Runner, cfg *config.Config, resolver versioning.Resolver, ...) (*pipeline.ChangelogPipeline, error)
- func BuildPipeline(runner port.Runner, cfg *config.Config, resolver versioning.Resolver, ...) (*pipeline.Pipeline, error)
- func CheckBranch(runner port.Runner, cfg *config.Config, env string, force bool) error
- func CheckCliff(runner port.Runner, driver *config.ContentDriver, mode string) error
- func CurrentTag(runner port.Runner, cfg *config.Config, env string) (string, error)
- func CurrentVersion(runner port.Runner, cfg *config.Config, env string) (string, error)
- func EffectiveCliffConfig(cfg *config.Config, driver *config.ContentDriver, mode, env string) (string, error)
- func IsPromotionGuard(err error) bool
- func NewResolver(cfg *config.Config, env string, force bool, versionOverride, buildID string, ...) (versioning.Resolver, error)
- func PreflightCheck(runner port.Runner) error
- func ReadGPGSign(runner port.Runner) bool
- func RuntimeCheck(runner port.Runner, cfg *config.Config, header func(title string), ...)
- func ValidateBuildID(build string) error
- type PipelineOpts
- type RuntimeCheckItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildChangelogPipeline ¶ added in v0.6.0
func BuildChangelogPipeline(runner port.Runner, cfg *config.Config, resolver versioning.Resolver, opts PipelineOpts) (*pipeline.ChangelogPipeline, error)
BuildChangelogPipeline constructs a ChangelogPipeline from config.
func BuildPipeline ¶
func BuildPipeline(runner port.Runner, cfg *config.Config, resolver versioning.Resolver, opts PipelineOpts) (*pipeline.Pipeline, error)
BuildPipeline constructs a release Pipeline from config. All generator and platform instances are created here — none are created in internal/cmd/.
func CheckBranch ¶ added in v0.20.0
CheckBranch enforces the per-environment branch guard: when the active environment declares a branch, the current git branch must match it. This prevents operating on an environment (e.g. releasing prod) from the wrong branch. It is a no-op when env is empty or the environment has no branch set. force bypasses the check entirely.
func CheckCliff ¶ added in v0.6.0
CheckCliff runs git-cliff --context --no-exec against the effective merged config for the given content driver. mode must be "changelog" or "release-notes". Returns nil if git-cliff accepts the config.
func CurrentTag ¶ added in v0.4.0
CurrentTag returns the latest existing git tag for the given strategy and environment. For single-env strategies, env is ignored. For per-env strategies, env is required.
func CurrentVersion ¶ added in v0.19.0
CurrentVersion returns the bare semantic version of the latest tag (the tag with any prefix / env / build components stripped). For per-env strategies the version is parsed via the effective tag_format; for single-env strategies the tag prefix is stripped.
func EffectiveCliffConfig ¶ added in v0.6.0
func EffectiveCliffConfig(cfg *config.Config, driver *config.ContentDriver, mode, env string) (string, error)
EffectiveCliffConfig returns the effective merged git-cliff TOML for the given content driver and mode ("changelog" or "release-notes"). cfg and env are used to derive the build-id postprocessor (when versioning.tag_format contains {build}) so the output matches what the pipeline actually feeds git-cliff.
If driver is nil or has no generator set, the embedded default TOML is returned. Returns an error if driver.Generator is set to something other than "git-cliff".
func IsPromotionGuard ¶ added in v0.8.0
IsPromotionGuard reports whether err is one of the per-env promotion guards (E001/E002/E003 from ADR-0007). The cmd layer uses this to map such failures to exit code 4 without importing the perenv package directly.
func NewResolver ¶
func NewResolver(cfg *config.Config, env string, force bool, versionOverride, buildID string, runner port.Runner) (versioning.Resolver, error)
NewResolver builds the appropriate versioning.Resolver from config. env is the active environment name (empty for non-per-env strategies). force is the --force flag value. versionOverride is set when --version X.Y.Z is passed; when non-empty a StaticResolver is returned for all strategies, bypassing git calls entirely. buildID is set when --build <id> is passed; requires versionOverride to be set.
func PreflightCheck ¶ added in v0.6.0
PreflightCheck verifies git binary availability and git user name/email. Called automatically before heraut release and heraut changelog.
func ReadGPGSign ¶ added in v0.12.0
ReadGPGSign reads tag.gpgSign from git config and returns true when it is set to "true". Any error (key absent, git not available) is treated as false — non-signing is the safe default. Callers should pass a non-dry-run runner so the config is always read regardless of --dry-run.
func RuntimeCheck ¶ added in v0.6.0
func RuntimeCheck( runner port.Runner, cfg *config.Config, header func(title string), dispatch func(name string, run func() RuntimeCheckItem), )
RuntimeCheck verifies all runtime dependencies, grouped into three sections: Git, Platforms, and Generators. header is called once per section before its items. dispatch is called once per item with the label shown while the check runs; the run function performs the check and returns the result.
Check order:
Git: git binary → user.name → user.email → working tree Platforms: glab (GitLab) → gh (GitHub) Generators: git-cliff → cocogitto → communique
Configured tools are hard errors when missing; unconfigured-but-supported tools warn when absent and succeed silently when present.
func ValidateBuildID ¶ added in v0.19.0
ValidateBuildID reports whether a --build value is usable as a tag component. Delegates to tagfmt so cmd does not import the versioning layer directly.
Types ¶
type PipelineOpts ¶
type PipelineOpts struct {
DryRun bool
Force bool
VersionOverride string
Env string
Out io.Writer
// Commit and Tag are used by the changelog pipeline only.
Commit bool
Tag bool
// SignTags mirrors git config tag.gpgSign — when true the pipeline creates
// signed tags (-s) instead of annotated ones. Set by the caller via ReadGPGSign.
SignTags bool
}
PipelineOpts carries runtime options for building a pipeline.
type RuntimeCheckItem ¶ added in v0.6.0
type RuntimeCheckItem struct {
Name string
Value string // resolved value (e.g. version string, identity, "clean")
Err error
IsWarn bool // advisory only — shown with ! but does not fail the overall check
}
RuntimeCheckItem records the outcome of one runtime check.