stages

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteFileAtomic added in v0.4.0

func WriteFileAtomic(path string, data []byte, perm os.FileMode) (err error)

WriteFileAtomic replaces path with data via a temp file in the same directory and a rename, so an interrupted write never leaves a truncated file behind; the result has mode perm.

Types

type BumpOnSecurityFixStrategy

type BumpOnSecurityFixStrategy struct {
	CheckFunc func(p processor.Processor) bool
	// CommentFunc, when set, composes the inline intent comment written on
	// the epoch line (e.g. "updated bumps; fixes: ..."). Empty result or nil
	// func leaves the epoch line comment-free.
	CommentFunc func(p processor.Processor) string
	// EpochFunc, when set, computes the new epoch; nil means current + 1.
	EpochFunc func(p processor.Processor) int64
}

BumpOnSecurityFixStrategy bumps epoch by 1 for security fixes

func (*BumpOnSecurityFixStrategy) CalculateNewEpoch

func (b *BumpOnSecurityFixStrategy) CalculateNewEpoch(p processor.Processor) int64

func (*BumpOnSecurityFixStrategy) EpochComment added in v0.3.0

EpochComment implements epochCommenter.

func (*BumpOnSecurityFixStrategy) GetReason

func (b *BumpOnSecurityFixStrategy) GetReason() string

func (*BumpOnSecurityFixStrategy) ShouldUpdateEpoch

func (b *BumpOnSecurityFixStrategy) ShouldUpdateEpoch(p processor.Processor) bool

type EpochStage

type EpochStage struct {
	processor.BaseStage
	Strategy EpochStrategy
}

EpochStage handles epoch updates using a configurable strategy

func NewEpochStage

func NewEpochStage(strategy EpochStrategy) *EpochStage

NewEpochStage creates a new epoch stage with the given strategy

func (*EpochStage) Apply

func (*EpochStage) ShouldRun

func (e *EpochStage) ShouldRun(ctx context.Context, p processor.Processor) (bool, error)

type EpochStrategy

type EpochStrategy interface {
	ShouldUpdateEpoch(p processor.Processor) bool
	CalculateNewEpoch(p processor.Processor) int64
	GetReason() string
}

EpochStrategy defines how epoch should be handled

type FileWriterStage

type FileWriterStage struct {
	processor.BaseStage
	CreateBackup bool
	BackupSuffix string
}

FileWriterStage handles writing changes to disk

func NewFileWriterStage

func NewFileWriterStage(createBackup bool, backupSuffix string) *FileWriterStage

NewFileWriterStage creates a new file writer stage

func (*FileWriterStage) Apply

func (*FileWriterStage) ShouldRun

func (f *FileWriterStage) ShouldRun(ctx context.Context, p processor.Processor) (bool, error)

func (*FileWriterStage) Validate

type ResetOnVersionChangeStrategy

type ResetOnVersionChangeStrategy struct{}

ResetOnVersionChangeStrategy resets epoch to 0 when version changes

func (*ResetOnVersionChangeStrategy) CalculateNewEpoch

func (r *ResetOnVersionChangeStrategy) CalculateNewEpoch(p processor.Processor) int64

func (*ResetOnVersionChangeStrategy) GetReason

func (r *ResetOnVersionChangeStrategy) GetReason() string

func (*ResetOnVersionChangeStrategy) ShouldUpdateEpoch

func (r *ResetOnVersionChangeStrategy) ShouldUpdateEpoch(p processor.Processor) bool

type ValidationStage

type ValidationStage struct {
	processor.BaseStage
	ValidateOriginal bool // Also validate original YAML
	ValidateCurrent  bool // Validate current YAML
}

ValidationStage validates YAML syntax and structure

func NewValidationStage

func NewValidationStage(validateOriginal, validateCurrent bool) *ValidationStage

NewValidationStage creates a new validation stage

func (*ValidationStage) Apply

func (*ValidationStage) ShouldRun

func (v *ValidationStage) ShouldRun(ctx context.Context, p processor.Processor) (bool, error)

Jump to

Keyboard shortcuts

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