Documentation
¶
Index ¶
- Constants
- type BranchInfo
- type BranchNotFoundError
- type Config
- type Environment
- type EnvironmentLockedError
- type EnvironmentNotFoundError
- type InvalidMetadataError
- type MetaInfo
- type Metadata
- func (m *Metadata) AddBranchToEnvironment(env string, branch string, user string) error
- func (m *Metadata) IsEnvironmentLocked(env string) bool
- func (m *Metadata) IsLockStale(env string) bool
- func (m *Metadata) IsLockedByUser(env string, user string) bool
- func (m *Metadata) LockEnvironment(env string, user string, reason string) error
- func (m *Metadata) RemoveBranchFromEnvironment(env string, branch string, user string) error
- func (m *Metadata) UnlockEnvironment(env string) error
- func (m *Metadata) UpdateMeta(user, command string)
- type MetadataReadError
- type MetadataWriteError
- type PromotionEvent
- type Reader
- type Webhook
- type Writer
Constants ¶
const ( MetadataBranch = "hitch-metadata" MetadataFile = "hitch.json" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BranchInfo ¶
type BranchInfo struct {
CreatedAt time.Time `json:"created_at"`
CreatedBy string `json:"created_by,omitempty"`
PromotedTo []string `json:"promoted_to"`
PromotedHistory []PromotionEvent `json:"promoted_history,omitempty"`
MergedToMainAt *time.Time `json:"merged_to_main_at,omitempty"`
MergedToMainBy string `json:"merged_to_main_by,omitempty"`
LastCommitAt time.Time `json:"last_commit_at,omitempty"`
LastCommitSHA string `json:"last_commit_sha,omitempty"`
EligibleForCleanupAt *time.Time `json:"eligible_for_cleanup_at,omitempty"`
}
BranchInfo tracks the lifecycle of a feature branch
type BranchNotFoundError ¶
type BranchNotFoundError struct {
Branch string
}
BranchNotFoundError is returned when a branch doesn't exist
func (*BranchNotFoundError) Error ¶
func (e *BranchNotFoundError) Error() string
type Config ¶
type Config struct {
RetentionDaysAfterMerge int `json:"retention_days_after_merge"`
StaleDaysNoActivity int `json:"stale_days_no_activity"`
BaseBranch string `json:"base_branch"`
LockTimeoutMinutes int `json:"lock_timeout_minutes"`
AutoRebuildOnPromote bool `json:"auto_rebuild_on_promote"`
ConflictStrategy string `json:"conflict_strategy"`
NotificationWebhooks []Webhook `json:"notification_webhooks,omitempty"`
}
Config holds global configuration
type Environment ¶
type Environment struct {
Base string `json:"base"`
Features []string `json:"features"`
Locked bool `json:"locked"`
LockedBy string `json:"locked_by,omitempty"`
LockedAt time.Time `json:"locked_at,omitempty"`
LockedReason string `json:"locked_reason,omitempty"`
LastRebuild time.Time `json:"last_rebuild,omitempty"`
LastRebuildCommit string `json:"last_rebuild_commit,omitempty"`
}
Environment represents a deployment environment (dev, qa, etc.)
type EnvironmentLockedError ¶
EnvironmentLockedError is returned when an environment is locked by another user
func (*EnvironmentLockedError) Error ¶
func (e *EnvironmentLockedError) Error() string
type EnvironmentNotFoundError ¶
type EnvironmentNotFoundError struct {
Environment string
}
EnvironmentNotFoundError is returned when an environment doesn't exist
func (*EnvironmentNotFoundError) Error ¶
func (e *EnvironmentNotFoundError) Error() string
type InvalidMetadataError ¶
InvalidMetadataError is returned when metadata format is invalid
func (*InvalidMetadataError) Error ¶
func (e *InvalidMetadataError) Error() string
func (*InvalidMetadataError) Unwrap ¶
func (e *InvalidMetadataError) Unwrap() error
type MetaInfo ¶
type MetaInfo struct {
InitializedAt time.Time `json:"initialized_at"`
InitializedBy string `json:"initialized_by,omitempty"`
LastModifiedAt time.Time `json:"last_modified_at"`
LastModifiedBy string `json:"last_modified_by,omitempty"`
LastCommand string `json:"last_command,omitempty"`
HitchVersion string `json:"hitch_version"`
}
MetaInfo contains metadata about the metadata itself
type Metadata ¶
type Metadata struct {
Version string `json:"version"`
Environments map[string]Environment `json:"environments"`
Branches map[string]BranchInfo `json:"branches"`
Config Config `json:"config"`
Meta MetaInfo `json:"metadata"`
}
Metadata represents the complete hitch.json structure
func NewMetadata ¶
NewMetadata creates a new Metadata structure with defaults
func (*Metadata) AddBranchToEnvironment ¶
AddBranchToEnvironment adds a branch to an environment's feature list
func (*Metadata) IsEnvironmentLocked ¶
IsEnvironmentLocked checks if an environment is locked
func (*Metadata) IsLockStale ¶
IsLockStale checks if a lock is older than the timeout
func (*Metadata) IsLockedByUser ¶
IsLockedByUser checks if an environment is locked by a specific user
func (*Metadata) LockEnvironment ¶
LockEnvironment locks an environment
func (*Metadata) RemoveBranchFromEnvironment ¶
RemoveBranchFromEnvironment removes a branch from an environment's feature list
func (*Metadata) UnlockEnvironment ¶
UnlockEnvironment unlocks an environment
func (*Metadata) UpdateMeta ¶
UpdateMeta updates the metadata modification tracking
type MetadataReadError ¶
MetadataReadError is returned when metadata cannot be read
func (*MetadataReadError) Error ¶
func (e *MetadataReadError) Error() string
func (*MetadataReadError) Unwrap ¶
func (e *MetadataReadError) Unwrap() error
type MetadataWriteError ¶
MetadataWriteError is returned when metadata cannot be written
func (*MetadataWriteError) Error ¶
func (e *MetadataWriteError) Error() string
func (*MetadataWriteError) Unwrap ¶
func (e *MetadataWriteError) Unwrap() error
type PromotionEvent ¶
type PromotionEvent struct {
Environment string `json:"environment"`
PromotedAt time.Time `json:"promoted_at"`
PromotedBy string `json:"promoted_by,omitempty"`
DemotedAt *time.Time `json:"demoted_at,omitempty"`
DemotedBy string `json:"demoted_by,omitempty"`
}
PromotionEvent records a single promotion/demotion event
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader handles reading metadata from the hitch-metadata branch
func NewReader ¶
func NewReader(repo *git.Repository) *Reader
NewReader creates a new metadata reader
type Webhook ¶
type Webhook struct {
URL string `json:"url"`
Events []string `json:"events"`
Headers map[string]string `json:"headers,omitempty"`
}
Webhook represents a notification webhook configuration
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer handles writing metadata to the hitch-metadata branch
func NewWriter ¶
func NewWriter(repo *git.Repository) *Writer
NewWriter creates a new metadata writer