Documentation
¶
Index ¶
- func BumpBatchFingerprint(dir string) (map[string]string, error)
- func BumpFilename(base string, suffix string) string
- func CollectBumps(ctx context.Context, logger *slog.Logger, dir string, cfg *Config, ...) (map[string]*ReleaseGroupStatus, error)
- func CommitCheckpointFilename(base string) string
- func ConfigFilename(base string) string
- func DeleteBumps(ctx context.Context, dir string) error
- func DeleteCommitCheckpoint(dir string) error
- func Dir(base string) string
- func GetCurrentVersion(ctx context.Context, runner Runner, dir string, group ReleaseGroup) (*semver.Version, error)
- func GetNextVersion(ctx context.Context, runner Runner, dir string, group ReleaseGroup, ...) (string, error)
- func GetWd(start string) (wd string, err error)
- func Initialize(baseDir string) error
- func SaveCommitCheckpoint(dir string, checkpoint *CommitCheckpoint) error
- func SaveConfig(baseDir string, cfg *Config) error
- func SquashBumps(ctx context.Context, logger *slog.Logger, bumps []ParsedBump, cfg *Config) map[string]*ReleaseGroupStatus
- func VersionFilename(base string) string
- type BumpLevel
- type Commit
- type CommitCheckpoint
- type Config
- type ExecRunner
- type FakeProvenance
- type FakeRunner
- type FakeRunnerCall
- type GitProvenance
- type GroupInvocation
- func NewCatInvocation(group ReleaseGroup, version string) (GroupInvocation, error)
- func NewChangelogInvocation(group ReleaseGroup, nextVersion string, status *ReleaseGroupStatus) (GroupInvocation, error)
- func NewCurrentInvocation(group ReleaseGroup) (GroupInvocation, error)
- func NewNextInvocation(group ReleaseGroup, nextVersion string) (GroupInvocation, error)
- type InvalidConfigError
- type LogEntry
- type ParsedBump
- type Provenance
- type ReleaseGroup
- type ReleaseGroupStatus
- type Runner
- type Verb
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BumpBatchFingerprint ¶ added in v0.0.7
BumpBatchFingerprint hashes the pending bump files, identifying the batch a commit attempt operates on.
func BumpFilename ¶
func CollectBumps ¶ added in v0.0.5
func CollectBumps(ctx context.Context, logger *slog.Logger, dir string, cfg *Config, provenance Provenance) (map[string]*ReleaseGroupStatus, error)
CollectBumps composes GatherBumps and SquashBumps: it reads the pending bump files in dir and reduces them to per-group release status.
func CommitCheckpointFilename ¶ added in v0.0.7
func ConfigFilename ¶
func DeleteCommitCheckpoint ¶ added in v0.0.7
DeleteCommitCheckpoint removes the checkpoint; a missing file is not an error.
func GetCurrentVersion ¶ added in v0.0.5
func GetNextVersion ¶ added in v0.0.5
func Initialize ¶
func SaveCommitCheckpoint ¶ added in v0.0.7
func SaveCommitCheckpoint(dir string, checkpoint *CommitCheckpoint) error
func SaveConfig ¶
func SquashBumps ¶ added in v0.0.7
func SquashBumps(ctx context.Context, logger *slog.Logger, bumps []ParsedBump, cfg *Config) map[string]*ReleaseGroupStatus
SquashBumps reduces parsed bump files to per-group release status: the highest bump level wins per group and changelog entries are ordered by commit timestamp. Bumps for groups absent from cfg and entries with unknown levels are skipped with a warning. It touches neither disk nor git.
func VersionFilename ¶
Types ¶
type CommitCheckpoint ¶ added in v0.0.7
type CommitCheckpoint struct {
// Batch fingerprints the pending bump files (base name -> content hash)
// the checkpoint belongs to. A retry with different pending bumps is a
// different batch and must not reuse this checkpoint.
Batch map[string]string `toml:"batch"`
// Released maps release group names to the version released for them in
// a previous attempt at this batch.
Released map[string]string `toml:"released"`
}
CommitCheckpoint records the progress of a partially failed `bumper commit` so a retry can skip release groups whose commands already succeeded. It is written after each group completes and removed once the whole batch has been released.
func LoadCommitCheckpoint ¶ added in v0.0.7
func LoadCommitCheckpoint(dir string) (*CommitCheckpoint, error)
LoadCommitCheckpoint reads a checkpoint left by a failed commit attempt. It returns nil without error when no checkpoint exists.
type Config ¶
type Config struct {
Groups []ReleaseGroup `json:"groups,omitempty,omitzero" toml:"groups,omitempty,omitzero" yaml:"groups,omitempty,omitzero"`
}
func LoadConfig ¶
func (*Config) IndexReleaseGroups ¶
func (c *Config) IndexReleaseGroups() map[string]ReleaseGroup
type ExecRunner ¶ added in v0.0.7
type ExecRunner struct{}
ExecRunner runs group commands as child processes with stderr passed through to the parent process.
func (ExecRunner) Run ¶ added in v0.0.7
func (ExecRunner) Run(ctx context.Context, dir string, inv GroupInvocation, stdout io.Writer) error
type FakeProvenance ¶ added in v0.0.7
FakeProvenance serves canned commits from memory so callers can be tested without a git repository.
type FakeRunner ¶ added in v0.0.7
type FakeRunner struct {
Calls []FakeRunnerCall
Stdout map[Verb]string
Err error
}
FakeRunner records every invocation and plays back canned stdout per verb so callers can be tested without spawning processes.
func (*FakeRunner) Run ¶ added in v0.0.7
func (f *FakeRunner) Run(_ context.Context, dir string, inv GroupInvocation, stdout io.Writer) error
type FakeRunnerCall ¶ added in v0.0.7
type FakeRunnerCall struct {
Dir string
Invocation GroupInvocation
}
type GitProvenance ¶ added in v0.0.7
GitProvenance resolves bump-file provenance from the git repository containing Dir, deepening shallow clones as needed. A directory outside any git repository degrades to empty results with a warning.
func NewGitProvenance ¶ added in v0.0.7
func NewGitProvenance(logger *slog.Logger, dir string) *GitProvenance
type GroupInvocation ¶ added in v0.0.7
GroupInvocation is a fully-resolved group command: the argv to execute and the BUMPER_* environment variables that carry the protocol inputs. Env holds KEY=VALUE pairs appended to the parent process environment.
func NewCatInvocation ¶ added in v0.0.7
func NewCatInvocation(group ReleaseGroup, version string) (GroupInvocation, error)
func NewChangelogInvocation ¶ added in v0.0.7
func NewChangelogInvocation(group ReleaseGroup, nextVersion string, status *ReleaseGroupStatus) (GroupInvocation, error)
func NewCurrentInvocation ¶ added in v0.0.7
func NewCurrentInvocation(group ReleaseGroup) (GroupInvocation, error)
func NewNextInvocation ¶ added in v0.0.7
func NewNextInvocation(group ReleaseGroup, nextVersion string) (GroupInvocation, error)
type InvalidConfigError ¶ added in v0.0.5
type InvalidConfigError struct {
// contains filtered or unexported fields
}
func (*InvalidConfigError) Error ¶ added in v0.0.5
func (e *InvalidConfigError) Error() string
type ParsedBump ¶ added in v0.0.7
ParsedBump is one bump file's parsed content plus its provenance: the levels recorded per release group, the changelog message, and the commit that introduced the file (nil when unresolved).
func GatherBumps ¶ added in v0.0.7
func GatherBumps(ctx context.Context, logger *slog.Logger, dir string, provenance Provenance) ([]ParsedBump, error)
GatherBumps globs the pending bump files in dir, parses each file's front matter and message, and resolves the commit that introduced it.
type Provenance ¶ added in v0.0.7
type Provenance interface {
Resolve(ctx context.Context, bumpFiles []string) (map[string]Commit, error)
}
Provenance resolves the commit that introduced each bump file. Files that cannot be resolved are absent from the returned map; callers treat that as "no provenance" rather than an error.
type ReleaseGroup ¶
type ReleaseGroup struct {
Name string `json:"name" toml:"name" yaml:"name"`
DisplayName string `json:"display_name,omitempty" toml:"display_name,omitempty" yaml:"display_name,omitempty"`
ChangelogCMD []string `json:"changelog_cmd,omitempty,omitzero" toml:"changelog_cmd,omitempty,omitzero" yaml:"changelog_cmd,omitempty,omitzero"`
CatCMD []string `json:"cat_cmd,omitempty,omitzero" toml:"cat_cmd,omitempty,omitzero" yaml:"cat_cmd,omitempty,omitzero"`
CurrentCMD []string `json:"current_cmd,omitempty,omitzero" toml:"current_cmd,omitempty,omitzero" yaml:"current_cmd,omitempty,omitzero"`
NextCMD []string `json:"next_cmd,omitempty,omitzero" toml:"next_cmd,omitempty,omitzero" yaml:"next_cmd,omitempty,omitzero"`
}