Documentation
¶
Overview ¶
Package deploys keeps the per-deployment history of deploys: which revision was deployed, what triggered it, how it went and its output. Rollback picks a past record and redeploys its revision.
Index ¶
- Constants
- Variables
- type LogWriter
- type Phase
- type PhaseStart
- type Record
- type Status
- type Store
- func (s *Store) Delete(deployment string) error
- func (s *Store) Finish(deployment, id, revision, message string, deployErr error) error
- func (s *Store) Get(deployment, id string) (Record, error)
- func (s *Store) List(deployment string) ([]Record, error)
- func (s *Store) OpenLog(deployment, id string) (*LogWriter, error)
- func (s *Store) ReadLog(deployment, id string) (string, []PhaseStart, error)
- func (s *Store) SetPhase(deployment, id string, phase Phase) error
- func (s *Store) Start(deployment string, rec Record) (Record, error)
- type Trigger
Constants ¶
const (
// MaxLogBytes caps one deploy's stored output.
MaxLogBytes = 1 << 20
)
Variables ¶
var ErrNotFound = errors.New("deploy record not found")
Functions ¶
This section is empty.
Types ¶
type LogWriter ¶
type LogWriter struct {
// contains filtered or unexported fields
}
LogWriter appends a deploy's output lines to its log file and stops at MaxLogBytes.
type Phase ¶
type Phase string
Phase is where a deploy is in its life. Queued, building and deploying are set while it runs. Active marks the newest successful deploy, which is the one serving; older successful ones read as removed.
type PhaseStart ¶
PhaseStart marks the output line at which a deploy entered a phase, so a log can be split into its build and deploy parts.
type Record ¶
type Record struct {
ID string `json:"id"`
Action string `json:"action,omitempty"`
Revision string `json:"revision,omitempty"`
Branch string `json:"branch,omitempty"`
Message string `json:"message,omitempty"`
Trigger Trigger `json:"trigger"`
Status Status `json:"status"`
Phase Phase `json:"phase"`
Error string `json:"error,omitempty"`
StartedAt time.Time `json:"started_at"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) Finish ¶
Finish closes a running record. A non-empty revision replaces the requested one with the commit that was actually fetched, and message is that commit's subject.
func (*Store) List ¶
List returns the records newest first. Only the newest successful deploy is active; earlier successful ones are reported as removed.
func (*Store) ReadLog ¶
func (s *Store) ReadLog(deployment, id string) (string, []PhaseStart, error)
ReadLog returns a deploy's stored output and where each phase began in it.