Documentation ¶
Index ¶
- Constants
- Variables
- func FormatHookOutputPath(runID, hookRunID string) string
- func FormatRunManifestOutputPath(runID string) string
- func NewHookRunID(actionIdx, hookIdx int) string
- type Action
- type ActionHook
- type ActionOn
- type DBRunResultIterator
- type DBTaskResultIterator
- type Hook
- type HookOutputWriter
- type HookType
- type MatchSpec
- type NewHookFunc
- type OnEvents
- type OutputWriter
- type RunManifest
- type RunResult
- type RunResultIterator
- type Service
- func (s *Service) GetRunResult(ctx context.Context, repositoryID string, runID string) (*RunResult, error)
- func (s *Service) GetTaskResult(ctx context.Context, repositoryID string, runID string, hookRunID string) (*TaskResult, error)
- func (s *Service) ListRunResults(ctx context.Context, repositoryID string, branchID, commitID string, ...) (RunResultIterator, error)
- func (s *Service) ListRunTaskResults(ctx context.Context, repositoryID string, runID string, after string) (TaskResultIterator, error)
- func (s *Service) PostCommitHook(ctx context.Context, record graveler.HookRecord) error
- func (s *Service) PostMergeHook(ctx context.Context, record graveler.HookRecord) error
- func (s *Service) PreCommitHook(ctx context.Context, record graveler.HookRecord) error
- func (s *Service) PreMergeHook(ctx context.Context, record graveler.HookRecord) error
- func (s *Service) Run(ctx context.Context, record graveler.HookRecord) error
- func (s *Service) UpdateCommitID(ctx context.Context, repositoryID string, storageNamespace string, ...) error
- type Source
- type Task
- type TaskResult
- type TaskResultIterator
- type Webhook
- type WebhookEventInfo
Constants ¶
View Source
const ( LogOutputExtension = ".log" LogOutputLocation = "_lakefs/actions/log" )
Variables ¶
View Source
var ( ErrInvalidAction = errors.New("invalid action") ErrInvalidEventType = errors.New("invalid event type") )
View Source
var ( ErrWebhookRequestFailed = errors.New("webhook request failed") ErrWebhookWrongFormat = errors.New("webhook wrong format") )
View Source
var ErrIteratorClosed = errors.New("iterator closed")
View Source
var ErrNotFound = errors.New("not found")
View Source
var ErrUnknownHookType = errors.New("unknown hook type")
Functions ¶
func FormatHookOutputPath ¶
func NewHookRunID ¶
Types ¶
type Action ¶
type Action struct { Name string `yaml:"name"` Description string `yaml:"description"` On OnEvents `yaml:"on"` Hooks []ActionHook `yaml:"hooks"` }
func LoadActions ¶
func ParseAction ¶
ParseAction helper function to read, parse and validate Action from a reader
type ActionHook ¶
type DBRunResultIterator ¶
type DBRunResultIterator struct {
// contains filtered or unexported fields
}
func NewDBRunResultIterator ¶
func (*DBRunResultIterator) Close ¶
func (it *DBRunResultIterator) Close()
func (*DBRunResultIterator) Err ¶
func (it *DBRunResultIterator) Err() error
func (*DBRunResultIterator) Next ¶
func (it *DBRunResultIterator) Next() bool
func (*DBRunResultIterator) Value ¶
func (it *DBRunResultIterator) Value() *RunResult
type DBTaskResultIterator ¶
type DBTaskResultIterator struct {
// contains filtered or unexported fields
}
func NewDBTaskResultIterator ¶
func (*DBTaskResultIterator) Close ¶
func (it *DBTaskResultIterator) Close()
func (*DBTaskResultIterator) Err ¶
func (it *DBTaskResultIterator) Err() error
func (*DBTaskResultIterator) Next ¶
func (it *DBTaskResultIterator) Next() bool
func (*DBTaskResultIterator) Value ¶
func (it *DBTaskResultIterator) Value() *TaskResult
type Hook ¶
type Hook interface {
Run(ctx context.Context, record graveler.HookRecord, writer *HookOutputWriter) error
}
Hook is the abstraction of the basic user-configured runnable building-stone
func NewWebhook ¶
func NewWebhook(h ActionHook, action *Action) (Hook, error)
type HookOutputWriter ¶
type HookOutputWriter struct { StorageNamespace string RunID string HookRunID string ActionName string HookID string Writer OutputWriter }
func (*HookOutputWriter) OutputWrite ¶
type NewHookFunc ¶
type NewHookFunc func(ActionHook, *Action) (Hook, error)
type OutputWriter ¶
type RunManifest ¶
type RunManifest struct { Run RunResult `json:"run"` HooksRun []TaskResult `json:"hooks,omitempty"` }
type RunResult ¶
type RunResult struct { RunID string `db:"run_id" json:"run_id"` BranchID string `db:"branch_id" json:"branch_id"` SourceRef string `db:"source_ref" json:"source_ref"` EventType string `db:"event_type" json:"event_type"` StartTime time.Time `db:"start_time" json:"start_time"` EndTime time.Time `db:"end_time" json:"end_time"` Passed bool `db:"passed" json:"passed"` CommitID string `db:"commit_id" json:"commit_id,omitempty"` }
type RunResultIterator ¶
type Service ¶
type Service struct { DB db.Database Source Source Writer OutputWriter }
func NewService ¶
func NewService(db db.Database, source Source, writer OutputWriter) *Service
func (*Service) GetRunResult ¶
func (*Service) GetTaskResult ¶
func (*Service) ListRunResults ¶
func (*Service) ListRunTaskResults ¶
func (*Service) PostCommitHook ¶
func (*Service) PostMergeHook ¶
func (*Service) PreCommitHook ¶
func (*Service) PreMergeHook ¶
type TaskResult ¶
type TaskResult struct { RunID string `db:"run_id" json:"run_id"` HookRunID string `db:"hook_run_id" json:"hook_run_id"` HookID string `db:"hook_id" json:"hook_id"` ActionName string `db:"action_name" json:"action_name"` StartTime time.Time `db:"start_time" json:"start_time"` EndTime time.Time `db:"end_time" json:"end_time"` Passed bool `db:"passed" json:"passed"` }
func (*TaskResult) LogPath ¶
func (r *TaskResult) LogPath() string
type TaskResultIterator ¶
type TaskResultIterator interface { Next() bool Value() *TaskResult Err() error Close() }
type Webhook ¶
type Webhook struct { ID string ActionName string URL string Timeout time.Duration QueryParams map[string][]string }
func (*Webhook) Run ¶
func (w *Webhook) Run(ctx context.Context, record graveler.HookRecord, writer *HookOutputWriter) (err error)
type WebhookEventInfo ¶
type WebhookEventInfo struct { EventType string `json:"event_type"` EventTime string `json:"event_time"` ActionName string `json:"action_name"` HookID string `json:"hook_id"` RepositoryID string `json:"repository_id"` BranchID string `json:"branch_id"` SourceRef string `json:"source_ref,omitempty"` CommitMessage string `json:"commit_message"` Committer string `json:"committer"` CommitMetadata map[string]string `json:"commit_metadata,omitempty"` }
Click to show internal directories.
Click to hide internal directories.