agent

package
v0.0.0-...-24eaeb0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2024 License: Apache-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DeploymentStateError   deploymentState = "error"
	DeploymentStateFailure deploymentState = "failure"
	DeploymentStateSuccess deploymentState = "success"
)

Variables

View Source
var ErrHookNotFound error = errors.New("unknown hook")

Functions

func FindState

func FindState(statuses []*github.DeploymentStatus, needleStates ...deploymentState) int

Types

type Agent

type Agent struct {
	Log         Logger
	Deployments *DeploymentOptions
	Deployer    *Deployer
}

Agent applies deployments

func (Agent) Run

func (agent Agent) Run(ctx context.Context, loop bool, sleepTime time.Duration) error

type Deployer

type Deployer struct {
	Deployments *DeploymentOptions
	Hooks       *Hooks
	Log         Logger
}

func (Deployer) Deploy

func (deployer Deployer) Deploy(ctx context.Context, depl *github.Deployment) error

type DeploymentOptions

type DeploymentOptions struct {
	Owner, Repo string
	Env         string
	Client      *github.Client
}

func (*DeploymentOptions) CreateDeploymentStatus

func (api *DeploymentOptions) CreateDeploymentStatus(ctx context.Context, depl *github.Deployment, state deploymentState, desc string) error

CreateDeploymentStatus publishes a new status message for the given deployment object.

see https://developer.github.com/v3/repos/deployments/#create-a-deployment-status state = pending | success | error | failure description = string(140)

func (*DeploymentOptions) FindNewestDeployment

func (api *DeploymentOptions) FindNewestDeployment(ctx context.Context) (*github.Deployment, error)

func (*DeploymentOptions) HasSuccessStatus

func (api *DeploymentOptions) HasSuccessStatus(ctx context.Context, depl *github.Deployment) (bool, error)

func (*DeploymentOptions) ListDeployments

func (api *DeploymentOptions) ListDeployments(ctx context.Context) (deployments []*github.Deployment, err error)

type Hooks

type Hooks struct {
	Path string
	// contains filtered or unexported fields
}

hooksCtx is used to define how to execute the hook scripts. When creating, the environment variables are provided.

func (*Hooks) WithEnv

func (h *Hooks) WithEnv(env []string) *Hooks

type Logger

type Logger interface {
	Printf(format string, v ...interface{})
	Println(v ...interface{})
}

Jump to

Keyboard shortcuts

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