Documentation
¶
Index ¶
- Constants
- Variables
- func CheckWorkerTimeout(event *api.Event)
- func Init(wopts *cloud.WorkerOptions, cloudAutoDiscovery bool)
- func IsEventFinished(event *api.Event) bool
- func LoadEventFromEtcd(eventID api.EventID) (*api.Event, error)
- func Resource2Quota(resource api.BuildResource, def cloud.Quota) cloud.Quota
- func SaveEventToEtcd(event *api.Event) error
- func SendCreateServiceEvent(service *api.Service) error
- func SendCreateVersionEvent(service *api.Service, version *api.Version) error
- type Handler
- type List
- type Operation
- type PostHook
- type Queue
Constants ¶
View Source
const ( // CreateServiceOps defines the operation to create a service, currently it // involves: clone repository (to check if repository exists). CreateServiceOps api.Operation = "create-service" // CreateVersionOps defines the operation to create a version, currently it // involves: clone repository, run CI if caicloud.yml exists and the operation // field in the version is not "Publish", thern tag it based on version name, // build docker image and push to caicloud registry, then run the postbuild // hook. CreateVersionOps api.Operation = "create-version" // CreateProjectVersionOps defines the operation to create a project version. CreateProjectVersionOps api.Operation = "create-projectversion" // PostStartPhase hooks phase PostStartPhase = "postStart" // PreStopPhase hooks phase PreStopPhase = "preStop" )
View Source
const (
// EventsUnfinished represents unfinished event dir path in etcd
EventsUnfinished = "/events/unfinished/"
)
Variables ¶
View Source
var (
CloudController *cloud.Controller
)
Functions ¶
func Init ¶
func Init(wopts *cloud.WorkerOptions, cloudAutoDiscovery bool)
Init init event manager Step1: init event operation map Step2: new a etcd client Step3: load unfinished events from etcd Step4: create a unfinished events watcher Step5: new a remote api manager
func IsEventFinished ¶
IsEventFinished return event is finished
func LoadEventFromEtcd ¶
LoadEventFromEtcd loads event from etcd.
func Resource2Quota ¶
Resource2Quota TODO: FIXME
func SaveEventToEtcd ¶
SaveEventToEtcd saves event in etcd.
func SendCreateServiceEvent ¶
SendCreateServiceEvent is a helper method which sends a create service event to etcd and wait for the event to be acked.
Types ¶
type Operation ¶
type Operation struct {
// PostHook is called when event create.
Handler Handler
// PostHook is called when event has finished, and event status is set.
PostHook PostHook
}
Operation define event operation.
Click to show internal directories.
Click to hide internal directories.