event

package
v0.0.0-...-418c65a Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2019 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResourceTypeAdmin     = "ADMIN"
	EventTypeValueChanged = "CONFIG_VALUE_CHANGED"
)
View Source
const (
	ResourceTypeBuild = "BUILD"

	BuildStateChange = "STATE_CHANGE"
)
View Source
const (
	ResourceTypeCommitQueue = "COMMIT_QUEUE"
	CommitQueueStartTest    = "START_TEST"
	CommitQueueConcludeTest = "CONCLUDE_TEST"
)
View Source
const (
	// resource type
	ResourceTypeDistro = "DISTRO"

	// event types
	EventDistroAdded    = "DISTRO_ADDED"
	EventDistroModified = "DISTRO_MODIFIED"
	EventDistroRemoved  = "DISTRO_REMOVED"
)
View Source
const (
	AllLogCollection  = "event_log"
	TaskLogCollection = "task_event_log"
)
View Source
const (
	// resource type
	ResourceTypeHost = "HOST"

	// event types
	EventHostCreated                  = "HOST_CREATED"
	EventHostStarted                  = "HOST_STARTED"
	EventHostAgentDeployed            = "HOST_AGENT_DEPLOYED"
	EventHostAgentDeployFailed        = "HOST_AGENT_DEPLOY_FAILED"
	EventHostAgentMonitorDeployed     = "HOST_AGENT_MONITOR_DEPLOYED"
	EventHostAgentMonitorDeployFailed = "HOST_AGENT_MONITOR_DEPLOY_FAILED"
	EventHostJasperDeployed           = "HOST_JASPER_DEPLOYED"
	EventHostJasperDeployFailed       = "HOST_JASPER_DEPLOY_FAILED"
	EventHostStatusChanged            = "HOST_STATUS_CHANGED"
	EventHostDNSNameSet               = "HOST_DNS_NAME_SET"
	EventHostProvisionError           = "HOST_PROVISION_ERROR"
	EventHostProvisionFailed          = "HOST_PROVISION_FAILED"
	EventHostProvisioned              = "HOST_PROVISIONED"
	EventHostRunningTaskSet           = "HOST_RUNNING_TASK_SET"
	EventHostRunningTaskCleared       = "HOST_RUNNING_TASK_CLEARED"
	EventHostTaskPidSet               = "HOST_TASK_PID_SET"
	EventHostMonitorFlag              = "HOST_MONITOR_FLAG"
	EventTaskFinished                 = "HOST_TASK_FINISHED"
	EventHostTeardown                 = "HOST_TEARDOWN"
	EventHostTerminatedExternally     = "HOST_TERMINATED_EXTERNALLY"
	EventHostExpirationWarningSent    = "HOST_EXPIRATION_WARNING_SENT"
	EventHostScriptExecuted           = "HOST_SCRIPT_EXECUTED"
	EventHostScriptExecuteFailed      = "HOST_SCRIPT_EXECUTE_FAILED"
)
View Source
const (
	ResourceTypePatch = "PATCH"

	PatchStateChange = "STATE_CHANGE"
)
View Source
const (
	// resource type
	ResourceTypeScheduler = "SCHEDULER"

	// event types
	EventSchedulerRun = "SCHEDULER_RUN"
)
View Source
const (
	GithubPullRequestSubscriberType  = "github_pull_request"
	JIRAIssueSubscriberType          = "jira-issue"
	JIRACommentSubscriberType        = "jira-comment"
	EvergreenWebhookSubscriberType   = "evergreen-webhook"
	EmailSubscriberType              = "email"
	SlackSubscriberType              = "slack"
	GithubMergeSubscriberType        = "github-merge"
	CommitQueueDequeueSubscriberType = "commit-queue-dequeue"
	SubscriberTypeNone               = "none"
)
View Source
const (
	OwnerTypePerson                         OwnerType = "person"
	OwnerTypeProject                        OwnerType = "project"
	TaskDurationKey                                   = "task-duration-secs"
	TaskPercentChangeKey                              = "task-percent-change"
	BuildDurationKey                                  = "build-duration-secs"
	BuildPercentChangeKey                             = "build-percent-change"
	VersionDurationKey                                = "version-duration-secs"
	VersionPercentChangeKey                           = "version-percent-change"
	TestRegexKey                                      = "test-regex"
	RenotifyIntervalKey                               = "renotify-interval"
	ImplicitSubscriptionPatchOutcome                  = "patch-outcome"
	ImplicitSubscriptionBuildBreak                    = "build-break"
	ImplicitSubscriptionSpawnhostExpiration           = "spawnhost-expiration"
	ImplicitSubscriptionSpawnHostOutcome              = "spawnhost-outcome"

	ImplicitSubscriptionCommitQueue = "commit-queue"
	ObjectTask                      = "task"
	ObjectVersion                   = "version"
	ObjectBuild                     = "build"
	ObjectHost                      = "host"
	ObjectPatch                     = "patch"

	TriggerOutcome                = "outcome"
	TriggerFailure                = "failure"
	TriggerSuccess                = "success"
	TriggerRegression             = "regression"
	TriggerExceedsDuration        = "exceeds-duration"
	TriggerRuntimeChangeByPercent = "runtime-change"
	TriggerExpiration             = "expiration"
	TriggerPatchStarted           = "started"
)
View Source
const (
	SelectorObject       = "object"
	SelectorID           = "id"
	SelectorProject      = "project"
	SelectorOwner        = "owner"
	SelectorRequester    = "requester"
	SelectorStatus       = "status"
	SelectorDisplayName  = "display-name"
	SelectorBuildVariant = "build-variant"
	SelectorInVersion    = "in-version"
	SelectorInBuild      = "in-build"
)
View Source
const (
	// resource type
	ResourceTypeTask = "TASK"

	// event types
	TaskCreated                 = "TASK_CREATED"
	TaskDispatched              = "TASK_DISPATCHED"
	TaskUndispatched            = "TASK_UNDISPATCHED"
	TaskStarted                 = "TASK_STARTED"
	TaskFinished                = "TASK_FINISHED"
	TaskRestarted               = "TASK_RESTARTED"
	TaskActivated               = "TASK_ACTIVATED"
	TaskDeactivated             = "TASK_DEACTIVATED"
	TaskAbortRequest            = "TASK_ABORT_REQUEST"
	TaskScheduled               = "TASK_SCHEDULED"
	TaskPriorityChanged         = "TASK_PRIORITY_CHANGED"
	TaskJiraAlertCreated        = "TASK_JIRA_ALERT_CREATED"
	TaskDepdendenciesOverridden = "TASK_DEPENDENCIES_OVERRIDDEN"
)
View Source
const (
	ResourceTypeVersion = "VERSION"
	VersionStateChange  = "STATE_CHANGE"
)
View Source
const (
	SubscriptionsCollection = "subscriptions"
)

Variables

View Source
var (
	TimestampKey    = bsonutil.MustHaveTag(EventLogEntry{}, "Timestamp")
	ResourceIdKey   = bsonutil.MustHaveTag(EventLogEntry{}, "ResourceId")
	ResourceTypeKey = bsonutil.MustHaveTag(EventLogEntry{}, "ResourceType")

	TypeKey = bsonutil.MustHaveTag(EventLogEntry{}, "EventType")
	DataKey = bsonutil.MustHaveTag(EventLogEntry{}, "Data")
)

Functions

func AdminEventsBefore

func AdminEventsBefore(before time.Time, n int) db.Q

func AllRecentHostEventsMatchStatus

func AllRecentHostEventsMatchStatus(hostId string, n int, status string) bool

func ByGuid

func ByGuid(guid string) db.Q

func CountUnprocessedEvents

func CountUnprocessedEvents() (int, error)

func DistroEventsForId

func DistroEventsForId(id string) db.Q

Distro Events

func DistroEventsInOrder

func DistroEventsInOrder(id string) db.Q

func HostEventsForId

func HostEventsForId(id string) db.Q

Host Events

func HostEventsInOrder

func HostEventsInOrder(id string) db.Q

func IsSubscriptionAllowed

func IsSubscriptionAllowed(sub Subscription) (bool, string)

func IsValidOwnerType

func IsValidOwnerType(in string) bool

func LogAdminEvent

func LogAdminEvent(section string, before, after evergreen.ConfigSection, user string) error

func LogBuildStateChangeEvent

func LogBuildStateChangeEvent(id, status string)

func LogCommitQueueConcludeTest

func LogCommitQueueConcludeTest(patchID, status string)

func LogCommitQueueStartTestEvent

func LogCommitQueueStartTestEvent(patchID string)

func LogDisplayTaskFinished

func LogDisplayTaskFinished(taskId string, execution int, status string)

func LogDistroAdded

func LogDistroAdded(distroId, userId string, data interface{})

func LogDistroEvent

func LogDistroEvent(distroId string, eventType string, eventData DistroEventData)

func LogDistroModified

func LogDistroModified(distroId, userId string, data interface{})

func LogDistroRemoved

func LogDistroRemoved(distroId, userId string, data interface{})

func LogExpirationWarningSent

func LogExpirationWarningSent(hostID string)

func LogHostAgentDeployFailed

func LogHostAgentDeployFailed(hostId string, err error)

func LogHostAgentDeployed

func LogHostAgentDeployed(hostId string)

func LogHostAgentMonitorDeployFailed

func LogHostAgentMonitorDeployFailed(hostId string, err error)

func LogHostAgentMonitorDeployed

func LogHostAgentMonitorDeployed(hostId string)

func LogHostCreated

func LogHostCreated(hostId string)

func LogHostDNSNameSet

func LogHostDNSNameSet(hostId string, dnsName string)

func LogHostEvent

func LogHostEvent(hostId string, eventType string, eventData HostEventData)

func LogHostJasperDeployFailed

func LogHostJasperDeployFailed(hostId string, err error)

func LogHostJasperDeployed

func LogHostJasperDeployed(hostId string, revision string)

func LogHostProvisionError

func LogHostProvisionError(hostId string)

LogHostProvisionError is used to log each failed provision attempt

func LogHostProvisioned

func LogHostProvisioned(hostId string)

func LogHostRunningTaskCleared

func LogHostRunningTaskCleared(hostId string, taskId string)

func LogHostRunningTaskSet

func LogHostRunningTaskSet(hostId string, taskId string)

func LogHostScriptExecuteFailed

func LogHostScriptExecuteFailed(hostID string, err error)

func LogHostScriptExecuted

func LogHostScriptExecuted(hostID string, logs string)

func LogHostStarted

func LogHostStarted(hostId string)

func LogHostStatusChanged

func LogHostStatusChanged(hostId, oldStatus, newStatus, user string, logs string)

func LogHostTaskPidSet

func LogHostTaskPidSet(hostId string, taskPid string)

func LogHostTeardown

func LogHostTeardown(hostId, teardownLogs string, success bool, duration time.Duration)

func LogHostTerminatedExternally

func LogHostTerminatedExternally(hostId string)

func LogJiraIssueCreated

func LogJiraIssueCreated(taskId string, execution int, jiraIssue string)

func LogManyTaskAbortRequests

func LogManyTaskAbortRequests(taskIds []string, userId string)

func LogMonitorOperation

func LogMonitorOperation(hostId string, op string)

func LogPatchStateChangeEvent

func LogPatchStateChangeEvent(id, newStatus string)

func LogProvisionFailed

func LogProvisionFailed(hostId string, setupLogs string)

LogProvisionFailed is used when Evergreen gives up on spawning a host after several retries

func LogSchedulerEvent

func LogSchedulerEvent(eventData SchedulerEventData)

LogSchedulerEvent takes care of logging the statistics about the scheduler at a given time. The ResourceId is the time that the scheduler runs.

func LogTaskAbortRequest

func LogTaskAbortRequest(taskId string, execution int, userId string)

func LogTaskActivated

func LogTaskActivated(taskId string, execution int, userId string)

func LogTaskCreated

func LogTaskCreated(taskId string, execution int)

func LogTaskDeactivated

func LogTaskDeactivated(taskId string, execution int, userId string)

func LogTaskDependenciesOverridden

func LogTaskDependenciesOverridden(taskId string, execution int, userID string)

func LogTaskDispatched

func LogTaskDispatched(taskId string, execution int, hostId string)

func LogTaskFinished

func LogTaskFinished(taskId string, execution int, hostId, status string)

func LogTaskPriority

func LogTaskPriority(taskId string, execution int, user string, priority int64)

func LogTaskRestarted

func LogTaskRestarted(taskId string, execution int, userId string)

func LogTaskScheduled

func LogTaskScheduled(taskId string, execution int, scheduledTime time.Time)

func LogTaskStarted

func LogTaskStarted(taskId string, execution int)

func LogTaskUndispatched

func LogTaskUndispatched(taskId string, execution int, hostId string)

func LogVersionStateChangeEvent

func LogVersionStateChangeEvent(id, newStatus string)

func MostRecentDistroEvents

func MostRecentDistroEvents(id string, n int) db.Q

func MostRecentHostEvents

func MostRecentHostEvents(id string, n int) db.Q

func MostRecentTaskEvents

func MostRecentTaskEvents(id string, n int) db.Q

func NewEventFromType

func NewEventFromType(resourceType string) interface{}

func RecentAdminEvents

func RecentAdminEvents(n int) db.Q

Admin Events RecentAdminEvents returns the N most recent admin events

func RecentSchedulerEvents

func RecentSchedulerEvents(distroId string, n int) db.Q

func RemoveSubscription

func RemoveSubscription(id string) error

func ResourceTypeKeyIs

func ResourceTypeKeyIs(key string) bson.M

func RevertConfig

func RevertConfig(guid string, user string) error

RevertConfig reverts one config section to the before state of the specified GUID in the event log

func SchedulerEventsForId

func SchedulerEventsForId(distroID string) db.Q

Scheduler Events

func TaskEventsForId

func TaskEventsForId(id string) db.Q

Task Events

func TaskEventsInOrder

func TaskEventsInOrder(id string) db.Q

func UpdateExecutions

func UpdateExecutions(hostId, taskId string, execution int) error

UpdateExecutions updates host events to track multiple executions of the same task

func ValidateSelectors

func ValidateSelectors(subscriber Subscriber, selectors []Selector) (bool, string)

Types

type AdminEventData

type AdminEventData struct {
	GUID    string           `bson:"guid" json:"guid"`
	User    string           `bson:"user" json:"user"`
	Section string           `bson:"section" json:"section"`
	Changes ConfigDataChange `bson:"changes" json:"changes"`
}

AdminEventData holds all potential data properties of a logged admin event

type BuildEventData

type BuildEventData struct {
	Status string `bson:"status" json:"status"`
}

type CommitQueueEventData

type CommitQueueEventData struct {
	Status string `bson:"status,omitempty" json:"status,omitempty"`
}

type ConfigDataChange

type ConfigDataChange struct {
	Before evergreen.ConfigSection `bson:"before" json:"before"`
	After  evergreen.ConfigSection `bson:"after" json:"after"`
}

type DBEventLogger

type DBEventLogger struct {
	// contains filtered or unexported fields
}

func NewDBEventLogger

func NewDBEventLogger(collection string) *DBEventLogger

func (*DBEventLogger) LogEvent

func (l *DBEventLogger) LogEvent(e *EventLogEntry) error

func (*DBEventLogger) LogManyEvents

func (l *DBEventLogger) LogManyEvents(events []EventLogEntry) error

func (*DBEventLogger) MarkProcessed

func (l *DBEventLogger) MarkProcessed(event *EventLogEntry) error

type DistroEventData

type DistroEventData struct {
	DistroId string      `bson:"d_id,omitempty" json:"d_id,omitempty"`
	UserId   string      `bson:"u_id,omitempty" json:"u_id,omitempty"`
	Data     interface{} `bson:"dstr,omitempty" json:"dstr,omitempty"`
}

DistroEventData implements EventData.

type EventLogEntry

type EventLogEntry struct {
	ID           string    `bson:"_id" json:"-"`
	ResourceType string    `bson:"r_type,omitempty" json:"resource_type,omitempty"`
	ProcessedAt  time.Time `bson:"processed_at" json:"processed_at"`

	Timestamp  time.Time   `bson:"ts" json:"timestamp"`
	ResourceId string      `bson:"r_id" json:"resource_id"`
	EventType  string      `bson:"e_type" json:"event_type"`
	Data       interface{} `bson:"data" json:"data"`
}

func Find

func Find(coll string, query db.Q) ([]EventLogEntry, error)

Find takes a collection storing events and a query, generated by one of the query functions, and returns a slice of events.

func FindAdmin

func FindAdmin(query db.Q) ([]EventLogEntry, error)

func FindAllByResourceID

func FindAllByResourceID(resourceID string) ([]EventLogEntry, error)

func FindLastProcessedEvent

func FindLastProcessedEvent() (*EventLogEntry, error)

func FindUnprocessedEvents

func FindUnprocessedEvents() ([]EventLogEntry, error)

FindUnprocessedEvents returns all unprocessed events in AllLogCollection. Events are considered unprocessed if their "processed_at" time IsZero

func (*EventLogEntry) MarshalBSON

func (e *EventLogEntry) MarshalBSON() ([]byte, error)

func (*EventLogEntry) Processed

func (e *EventLogEntry) Processed() (bool, time.Time)

Processed is whether or not this event has been processed. An event which has been processed has successfully have notifications intents created and stored, but does not indicate whether or not these notifications have been successfully sent to all recipients If true, the time is the time that this event was marked as processed. If false, time is the zero time

func (*EventLogEntry) SetBSON

func (e *EventLogEntry) SetBSON(raw mgobson.Raw) error

func (*EventLogEntry) UnmarshalBSON

func (e *EventLogEntry) UnmarshalBSON(in []byte) error

type EventLogger

type EventLogger interface {
	LogEvent(event *EventLogEntry) error
}

type GithubMergeSubscriber

type GithubMergeSubscriber struct {
	PRs         []PRInfo `bson:"prs"`
	Item        string   `bson:"item"`
	MergeMethod string   `bson:"merge_method"`
}

func (*GithubMergeSubscriber) String

func (s *GithubMergeSubscriber) String() string

type GithubPullRequestSubscriber

type GithubPullRequestSubscriber struct {
	Owner    string `bson:"owner"`
	Repo     string `bson:"repo"`
	PRNumber int    `bson:"pr_number"`
	Ref      string `bson:"ref"`
}

func (*GithubPullRequestSubscriber) String

func (s *GithubPullRequestSubscriber) String() string

type HostEventData

type HostEventData struct {
	AgentRevision  string        `bson:"a_rev,omitempty" json:"agent_revision,omitempty"`
	JasperRevision string        `bson:"j_rev,omitempty" json:"jasper_revision,omitempty"`
	OldStatus      string        `bson:"o_s,omitempty" json:"old_status,omitempty"`
	NewStatus      string        `bson:"n_s,omitempty" json:"new_status,omitempty"`
	Logs           string        `bson:"log,omitempty" json:"logs,omitempty"`
	Hostname       string        `bson:"hn,omitempty" json:"hostname,omitempty"`
	TaskId         string        `bson:"t_id,omitempty" json:"task_id,omitempty"`
	TaskExecution  int           `bson:"t_execution,omitempty" json:"task_execution,omitempty"`
	TaskPid        string        `bson:"t_pid,omitempty" json:"task_pid,omitempty"`
	TaskStatus     string        `bson:"t_st,omitempty" json:"task_status,omitempty"`
	Execution      string        `bson:"execution,omitempty" json:"execution,omitempty"`
	MonitorOp      string        `bson:"monitor_op,omitempty" json:"monitor,omitempty"`
	User           string        `bson:"usr" json:"user,omitempty"`
	Successful     bool          `bson:"successful,omitempty" json:"successful"`
	Duration       time.Duration `bson:"duration,omitempty" json:"duration"`
}

implements EventData

type JIRAIssueSubscriber

type JIRAIssueSubscriber struct {
	Project   string `bson:"project"`
	IssueType string `bson:"issue_type"`
}

func (*JIRAIssueSubscriber) String

func (s *JIRAIssueSubscriber) String() string

type OwnerType

type OwnerType string

type PRInfo

type PRInfo struct {
	Owner       string `bson:"owner"`
	Repo        string `bson:"repo"`
	Ref         string `bson:"ref"`
	PRNum       int    `bson:"pr_number"`
	CommitTitle string `bson:"commit_title"`
}

type PatchEventData

type PatchEventData struct {
	Status string `bson:"status,omitempty" json:"status,omitempty"`
}

type RecentHostAgentDeploys

type RecentHostAgentDeploys struct {
	HostID            string `bson:"host_id" json:"host_id" yaml:"host_id"`
	Count             int    `bson:"count" json:"count" yaml:"count"`
	Failed            int    `bson:"failed" json:"failed" yaml:"failed"`
	Success           int    `bson:"success" json:"success" yaml:"success"`
	HostStatusChanged int    `bson:"host_status_changed" json:"host_status_changed" yaml:"host_status_changed"`
	Last              string `bson:"last" json:"last" yaml:"last"`
	Total             int    `bson:"total" json:"total" yaml:"total"`
	message.Base      `bson:"metadata" json:"metadata" yaml:"metadata"`
}

RecentHostAgentDeploys is a type used to capture the results of an agent deploy.

func GetRecentAgentDeployStatuses

func GetRecentAgentDeployStatuses(hostID string, n int) (*RecentHostAgentDeploys, error)

GetRecentAgentDeployStatuses gets status of the the n most recent agent deploy attempts for the given hostID.

func GetRecentAgentMonitorDeployStatuses

func GetRecentAgentMonitorDeployStatuses(hostID string, n int) (*RecentHostAgentDeploys, error)

GetRecentAgentMonitorDeployStatuses gets status of the the n most recent agent monitor deploy attempts for the given hostID.

func (*RecentHostAgentDeploys) AllAttemptsFailed

func (m *RecentHostAgentDeploys) AllAttemptsFailed() bool

func (*RecentHostAgentDeploys) LastAttemptFailed

func (m *RecentHostAgentDeploys) LastAttemptFailed() bool

//////////////////////////////////////////////////////////////////////

Predicates to support error checking during the agent deploy process

func (*RecentHostAgentDeploys) Loggable

func (m *RecentHostAgentDeploys) Loggable() bool

func (*RecentHostAgentDeploys) Raw

func (m *RecentHostAgentDeploys) Raw() interface{}

func (*RecentHostAgentDeploys) String

func (m *RecentHostAgentDeploys) String() string

type SchedulerEventData

type SchedulerEventData struct {
	TaskQueueInfo TaskQueueInfo `bson:"tq_info" json:"task_queue_info"`
	DistroId      string        `bson:"d_id" json:"distro_id"`
}

implements EventData

type Selector

type Selector struct {
	Type string `bson:"type"`
	Data string `bson:"data"`
}

type Subscriber

type Subscriber struct {
	Type string `bson:"type"`
	// sad violin
	Target interface{} `bson:"target"`
}

func NewCommitQueueDequeueSubscriber

func NewCommitQueueDequeueSubscriber() Subscriber

func NewEmailSubscriber

func NewEmailSubscriber(t string) Subscriber

func NewGithubMergeSubscriber

func NewGithubMergeSubscriber(s GithubMergeSubscriber) Subscriber

func NewGithubStatusAPISubscriber

func NewGithubStatusAPISubscriber(s GithubPullRequestSubscriber) Subscriber

func NewSlackSubscriber

func NewSlackSubscriber(t string) Subscriber

func (*Subscriber) MarshalBSON

func (s *Subscriber) MarshalBSON() ([]byte, error)

func (*Subscriber) SetBSON

func (s *Subscriber) SetBSON(raw mgobson.Raw) error

func (*Subscriber) String

func (s *Subscriber) String() string

func (*Subscriber) UnmarshalBSON

func (s *Subscriber) UnmarshalBSON(in []byte) error

func (*Subscriber) Validate

func (s *Subscriber) Validate() error

type Subscription

type Subscription struct {
	ID             string            `bson:"_id"`
	ResourceType   string            `bson:"type"`
	Trigger        string            `bson:"trigger"`
	Selectors      []Selector        `bson:"selectors,omitempty"`
	RegexSelectors []Selector        `bson:"regex_selectors,omitempty"`
	Subscriber     Subscriber        `bson:"subscriber"`
	OwnerType      OwnerType         `bson:"owner_type"`
	Owner          string            `bson:"owner"`
	TriggerData    map[string]string `bson:"trigger_data,omitempty"`
}

func CreateOrUpdateImplicitSubscription

func CreateOrUpdateImplicitSubscription(resourceType string, id string,
	subscriber Subscriber, user string) (*Subscription, error)

func FindSubscriptionByID

func FindSubscriptionByID(id string) (*Subscription, error)

func FindSubscriptions

func FindSubscriptions(resourceType string, selectors []Selector) ([]Subscription, error)

FindSubscriptions finds all subscriptions of matching resourceType, and whose selectors match the selectors slice

func FindSubscriptionsByOwner

func FindSubscriptionsByOwner(owner string, ownerType OwnerType) ([]Subscription, error)

func NewBuildBreakSubscriptionByOwner

func NewBuildBreakSubscriptionByOwner(owner string, sub Subscriber) Subscription

func NewBuildOutcomeSubscriptionByVersion

func NewBuildOutcomeSubscriptionByVersion(versionID string, sub Subscriber) Subscription

func NewCommitQueueSubscriptionByOwner

func NewCommitQueueSubscriptionByOwner(owner string, sub Subscriber) Subscription

func NewPatchOutcomeSubscription

func NewPatchOutcomeSubscription(id string, sub Subscriber) Subscription

func NewPatchOutcomeSubscriptionByOwner

func NewPatchOutcomeSubscriptionByOwner(owner string, sub Subscriber) Subscription

func NewSpawnHostOutcomeByOwner

func NewSpawnHostOutcomeByOwner(owner string, sub Subscriber) Subscription

func NewSpawnhostExpirationSubscription

func NewSpawnhostExpirationSubscription(owner string, sub Subscriber) Subscription

func NewSubscriptionByID

func NewSubscriptionByID(resourceType, trigger, id string, sub Subscriber) Subscription

func NewSubscriptionByOwner

func NewSubscriptionByOwner(owner string, sub Subscriber, resourceType, trigger string) Subscription

func (*Subscription) SetBSON

func (s *Subscription) SetBSON(raw mgobson.Raw) error

func (*Subscription) String

func (s *Subscription) String() string

func (*Subscription) UnmarshalBSON

func (d *Subscription) UnmarshalBSON(in []byte) error

func (*Subscription) Upsert

func (s *Subscription) Upsert() error

func (*Subscription) Validate

func (s *Subscription) Validate() error

type TaskEventData

type TaskEventData struct {
	Execution int    `bson:"execution" json:"execution"`
	HostId    string `bson:"h_id,omitempty" json:"host_id,omitempty"`
	UserId    string `bson:"u_id,omitempty" json:"user_id,omitempty"`
	Status    string `bson:"s,omitempty" json:"status,omitempty"`
	JiraIssue string `bson:"jira,omitempty" json:"jira,omitempty"`

	Timestamp time.Time `bson:"ts,omitempty" json:"timestamp,omitempty"`
	Priority  int64     `bson:"pri,omitempty" json:"priority,omitempty"`
}

implements Data

type TaskQueueInfo

type TaskQueueInfo struct {
	TaskQueueLength  int           `bson:"tq_l" json:"task_queue_length"`
	NumHostsRunning  int           `bson:"n_h" json:"num_hosts_running"`
	ExpectedDuration time.Duration `bson:"ex_d" json:"expected_duration,"`
}

type UnmarshalEventLogEntry

type UnmarshalEventLogEntry struct {
	ID           interface{} `bson:"_id" json:"-"`
	ResourceType string      `bson:"r_type,omitempty" json:"resource_type,omitempty"`
	ProcessedAt  time.Time   `bson:"processed_at" json:"processed_at"`

	Timestamp  time.Time   `bson:"ts" json:"timestamp"`
	ResourceId string      `bson:"r_id" json:"resource_id"`
	EventType  string      `bson:"e_type" json:"event_type"`
	Data       mgobson.Raw `bson:"data" json:"data"`
}

type VersionEventData

type VersionEventData struct {
	Status string `bson:"status,omitempty" json:"status,omitempty"`
}

type WebhookSubscriber

type WebhookSubscriber struct {
	URL    string `bson:"url"`
	Secret []byte `bson:"secret"`
}

func (*WebhookSubscriber) String

func (s *WebhookSubscriber) String() string

Jump to

Keyboard shortcuts

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