github

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2017 License: BSD-2-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package github provides an http.Handler implementation that allows Empire to handle GitHub Deployments.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultTemplate is a text/template string that will be used to map a
	// deployment event to a docker image to deploy.
	DefaultTemplate = `{{ .Repository.FullName }}:{{ .Deployment.Sha }}`
)

Functions

func New

func New(e *empire.Empire, opts Options) http.Handler

func Ping

func Ping(w http.ResponseWriter, r *http.Request)

Types

type ConveyorImageBuilder added in v0.10.1

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

ConveyorImageBuilder provides an ImageBuilder implementation that integrates with the Conveyor (https://github.com/remind101/conveyor) Docker build system. If enabled, Empire will check if an Artifact in Conveyor exists for the git commit, and will trigger Conveyor to build it if it doesn't exist.

func NewConveyorImageBuilder added in v0.10.1

func NewConveyorImageBuilder(c *conveyor.Service) *ConveyorImageBuilder

NewConveyorImageBuilder returns a new ConveyorImageBuilder implementation that uses the given client.

func (*ConveyorImageBuilder) BuildImage added in v0.10.1

func (c *ConveyorImageBuilder) BuildImage(ctx context.Context, w io.Writer, event events.Deployment) (image.Image, error)

type Deployer added in v0.10.1

type Deployer interface {
	// Deploy performs the deployment, writing output to w. The output
	// written to w should be plain text.
	Deploy(context.Context, events.Deployment, io.Writer) error
}

Deployer represents something that can deploy a github deployment.

func DeployAsync added in v0.10.1

func DeployAsync(d Deployer) Deployer

DeployAsync wraps a Deployer to perform the Deploy within a goroutine.

type DeployerFunc added in v0.10.1

type DeployerFunc func(context.Context, events.Deployment, io.Writer) error

DeployerFunc is a function that implements the Deployer interface.

func (DeployerFunc) Deploy added in v0.10.1

func (fn DeployerFunc) Deploy(ctx context.Context, event events.Deployment, w io.Writer) error

type DeploymentHandler

type DeploymentHandler struct {
	Deployer
	// contains filtered or unexported fields
}

Deployment is an http.Handler for handling the `deployment` event.

func (*DeploymentHandler) ServeHTTP

func (h *DeploymentHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type EmpireDeployer added in v0.10.1

type EmpireDeployer struct {
	ImageBuilder
	// contains filtered or unexported fields
}

EmpireDeployer is a deployer implementation that uses the Deploy method in Empire to perform the deployment.

func NewEmpireDeployer added in v0.10.1

func NewEmpireDeployer(e *empire.Empire) *EmpireDeployer

NewEmpireDeployer returns a new EmpireDeployer instance.

func (*EmpireDeployer) Deploy added in v0.10.1

func (d *EmpireDeployer) Deploy(ctx context.Context, event events.Deployment, w io.Writer) error

Deploy builds/determines the docker image to deploy, then deploys it with Empire.

type ImageBuilder added in v0.10.1

type ImageBuilder interface {
	BuildImage(ctx context.Context, w io.Writer, event events.Deployment) (image.Image, error)
}

ImageBuilder is an interface that represents something that can build and return a Docker image from a GitHub commit. If you need to stream build logs back to the user, you can use the passed in io.Writer and write plain text logs to it.

func ImageFromTemplate added in v0.10.1

func ImageFromTemplate(t *template.Template) ImageBuilder

ImageFromTemplate returns an ImageBuilder that will execute a template to determine what docker image should be deployed. Note that this doesn't not actually perform any "build".

type ImageBuilderFunc added in v0.10.1

type ImageBuilderFunc func(context.Context, io.Writer, events.Deployment) (image.Image, error)

func (ImageBuilderFunc) BuildImage added in v0.10.1

func (fn ImageBuilderFunc) BuildImage(ctx context.Context, w io.Writer, event events.Deployment) (image.Image, error)

type Options

type Options struct {
	// The GitHub secret to ensure that the request was sent from GitHub.
	Secret string

	// If provided, specifies the environments that this Empire instance
	// should handle deployments for.
	Environments []string

	Deployer Deployer
}

type TugboatDeployer added in v0.10.1

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

TugboatDeployer is an implementtion of the deployer interface that sends logs and updates the status of the deployment within a Tugboat instance.

func NotifyTugboat added in v0.10.1

func NotifyTugboat(d Deployer, url string) *TugboatDeployer

NotifyTugboat wraps a Deployer to sent deployment logs and status updates to a Tugboat instance.

func (*TugboatDeployer) Deploy added in v0.10.1

func (d *TugboatDeployer) Deploy(ctx context.Context, event events.Deployment, out io.Writer) error

Jump to

Keyboard shortcuts

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