backend

package
v0.0.0-...-9fbb4a3 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2020 License: BSD-2-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const TEMPDIR string = "/tmp/"

Variables

This section is empty.

Functions

func StartRunner

func StartRunner(addr string) error

Types

type CIConfig

type CIConfig struct {
	Name      string            `yaml:"name"`
	ImageName string            `yaml:"image"`
	Env       map[string]string `yaml:"env,omitempty"`
	Steps     []struct {
		Name         string   `yaml:"name"`
		Dependencies []string `yaml:"dependencies,omitempty"`
		Cmd          string   `yaml:"command"`
	} `yaml:"steps"`
}

CI configuration to be read from the file system on the cloned repository. For now it's queit simple: - A name - An image for the container to be used - Some environments variables - A list of steps to execute

  • A name of the step
  • Dependencies needed by the execution to be installed
  • The command to execute

func LoadCIConfigFromFile

func LoadCIConfigFromFile(path string) (*CIConfig, error)

type Commit

type Commit struct {
	Id         string     `json:"id"`
	Timestamp  time.Time  `json:"timestamp"`
	Language   string     `json:"language"`
	Repository Repository `json:"repository"`
}

func (*Commit) GetRepositoryName

func (c *Commit) GetRepositoryName() string

type Dispatcher

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

func NewDispatcher

func NewDispatcher(commitQueue string, interval time.Duration, runners []RunnerProxy) *Dispatcher

func (*Dispatcher) Consume

func (d *Dispatcher) Consume() error

type HeartBeatRequest

type HeartBeatRequest struct{}

type HeartBeatResponse

type HeartBeatResponse struct {
	Alive bool
}

type HostingService

type HostingService string
const (
	GitHub    HostingService = "github"
	BitBucket HostingService = "bitbucket"
	GitLab                   = "gitlab"
)

type Repository

type Repository struct {
	HostingService HostingService `json:"hosting_service"`
	Name           string         `json:"name"`
	Branch         string         `json:"branch"`
}

func (Repository) CloneCommand

func (r Repository) CloneCommand(path string) (string, error)

type Runner

type Runner struct{}

func (*Runner) HeartBeat

func (r *Runner) HeartBeat(req HeartBeatRequest, res *HeartBeatResponse) error

func (*Runner) RunCommitJob

func (r *Runner) RunCommitJob(req RunnerRequest, res *RunnerResponse) error

type RunnerProxy

type RunnerProxy struct {
	Addr      string
	Alive     bool
	RpcClient *rpc.Client
}

func NewRunnerProxy

func NewRunnerProxy(addr string) *RunnerProxy

func (RunnerProxy) String

func (p RunnerProxy) String() string

type RunnerRequest

type RunnerRequest struct {
	CommitJob Commit
}

type RunnerResponse

type RunnerResponse struct {
	Response string
}

Jump to

Keyboard shortcuts

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