controller

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Successful BuildStatus = "success"
	Failure                = "failed"
	Skipped                = "skipped"
)

Variables

This section is empty.

Functions

Types

type BuildStatus

type BuildStatus string

type Controller

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

Controller that reconciles and manages containers

func NewController

func NewController(opts NewControllerOptions) (*Controller, error)

NewController creates a new controller from arguments

func (*Controller) Close

func (c *Controller) Close() error

func (*Controller) HandleTrigger

func (c *Controller) HandleTrigger(ctx *gin.Context)

HandleTrigger handles trigger web requests

func (*Controller) HandleWebHook

func (c *Controller) HandleWebHook(ctx *gin.Context)

func (*Controller) Listen

func (c *Controller) Listen()

func (*Controller) StopPolling

func (c *Controller) StopPolling()

type DockerClient

type DockerClient interface {
	ImagePull(ctx context.Context, ref string, options types.ImagePullOptions) (io.ReadCloser, error)
	ContainerRemove(ctx context.Context, containerID string, options types.ContainerRemoveOptions) error
	ContainerCreate(ctx context.Context, config *container.Config, hostConfig *container.HostConfig,
		networkingConfig *network.NetworkingConfig, containerName string) (container.ContainerCreateCreatedBody, error)
	ContainerStart(ctx context.Context, containerID string, opts types.ContainerStartOptions) error
	ContainerInspect(ctx context.Context, containerID string) (types.ContainerJSON, error)
}

Interface that defines the API surface of the Docker interactions

type MessageType

type MessageType interface {
	Validate() error
}

type NewControllerOptions

type NewControllerOptions struct {
	Cfg    *config.Config
	Client DockerClient
}

NewControllerOptions specifies options for creating new controllers

type Poll

type Poll struct{}

func (Poll) Validate

func (p Poll) Validate() error

type RunContainerOptions

type RunContainerOptions struct {
	Name string
}

type Trigger

type Trigger struct {
	Command       []string       `json:"command"`
	ImageName     string         `json:"image_name"`
	ImageTag      string         `json:"image_tag"`
	ContainerName string         `json:"container_name"`
	Ports         []config.Port  `json:"ports"`
	Mounts        []config.Mount `json:"mounts"`
}

func (Trigger) Validate

func (p Trigger) Validate() error

type WebHook

type WebHook struct {
	Event gitlab.PipelineEvent
}

func (WebHook) Validate

func (p WebHook) Validate() error

Jump to

Keyboard shortcuts

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