ci

package
v0.0.0-...-d195741 Latest Latest
Warning

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

Go to latest
Published: May 27, 2015 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

package ci handle ci job execution, persistence, andwsebservice.

Index

Constants

View Source
const (
	StatusKO      = 0
	StatusRunning = 1
	StatusOK      = 2
)

Variables

View Source
var (
	ErrUnreachable = errors.New("Cannot reach CI server")
)

Functions

func RunJobNow

func RunJobNow(name, remote, branch string)

Types

type Client

type Client struct {
	*format.ProtoClient
}

func NewClient

func NewClient(server string) Client

func (Client) AddJob

func (c Client) AddJob(jobname, remote, branch string) (err error)

AddJob add a job by it's name, remote and branch

func (Client) JobDetails

func (c Client) JobDetails(jobname string) (job *format.Job, err error)

func (Client) ListJobs

func (c Client) ListJobs(refresh, build bool) (jobs []*format.Job, err error)

ListJobs return the list of all jobs.

when 'refresh' (resp 'build') is true, the refresh (resp. build) log is sent too.

func (Client) RemoveJob

func (c Client) RemoveJob(jobname string) (err error)

Remove a job by its jobname

func (Client) Request

func (c Client) Request(req *format.Request) (resp *format.Response, err error)

turn a proto request into a response, error: dealing with protocol errors, and response error. return ErrUnreachable if this there was a communication error returns the protocol error otherwise

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

func NewDaemon(wd, dbfile string) (daemon Daemon, err error)

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)

type Status

type Status int

Jump to

Keyboard shortcuts

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