Documentation
¶
Overview ¶
package ci handle ci job execution, persistence, andwsebservice.
Index ¶
- Constants
- Variables
- func RunJobNow(name, remote, branch string)
- type Client
- func (c Client) AddJob(jobname, remote, branch string) (err error)
- func (c Client) JobDetails(jobname string) (job *format.Job, err error)
- func (c Client) ListJobs(refresh, build bool) (jobs []*format.Job, err error)
- func (c Client) RemoveJob(jobname string) (err error)
- func (c Client) Request(req *format.Request) (resp *format.Response, err error)
- type Daemon
- type HookServer
- type ProtobufServer
- type Status
Constants ¶
const ( StatusKO = 0 StatusRunning = 1 StatusOK = 2 )
Variables ¶
var (
ErrUnreachable = errors.New("Cannot reach CI server")
)
Functions ¶
Types ¶
type Client ¶
type Client struct {
*format.ProtoClient
}
func (Client) ListJobs ¶
ListJobs return the list of all jobs.
when 'refresh' (resp 'build') is true, the refresh (resp. build) log is sent too.
type Daemon ¶
type Daemon interface { // Heartbeats notifies the daemon to start all jobs HeartBeats() // the AND of all statuses Status() Status AddJob(path, remote, branch string) error RemoveJob(path string) error ListJobs(refreshResult, buildResult bool) *format.ListResponse JobDetails(job string) *format.LogResponse // marshal the internal configuration into this protobuf message Marshal() *format.Server // Unmarshal from this protobuf message Unmarshal(*format.Server) error }
Daemon defines the API for a Continuous Integration Server.
func NewDaemon ¶
NewDaemon creates a new instance given a working dir, and a dbfile.
dbfile must be a file containing a *format.Server message serialized message. if it does not exists, the daemon will start from scratch.
when the daemon receives a interrupt, kill or SIGTERM signal it persists its internal state into the dbfile.
type HookServer ¶
type HookServer struct {
Daemon
}
HookServer is an http Server that implements: POST * : triggers a hearbeat GET * : return a status code
func NewHookServer ¶
func NewHookServer(daemon Daemon) *HookServer
func (*HookServer) ServeHTTP ¶
func (s *HookServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP defines the http server
type ProtobufServer ¶
type ProtobufServer struct {
Daemon
}
ProtobufServer is an independent http server that just exposes an http protobuf protocol
func NewProtobufServer ¶
func NewProtobufServer(daemon Daemon) *ProtobufServer
func (*ProtobufServer) Execute ¶
func (s *ProtobufServer) Execute(q *format.Request) *format.Response
Execute actually run the service transform a request into a response. This is not a generic request/response protocol, the request is actually specific to the ci operations.
func (*ProtobufServer) ServeHTTP ¶
func (s *ProtobufServer) ServeHTTP(w http.ResponseWriter, r *http.Request)