hooks

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: Apache-2.0 Imports: 25 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NewDeployRunner         = newDeployRunner
	NewCloudRunDeployRunner = newCloudRunDeployRunner
)

for testing

View Source
var (
	NewRenderRunner = newRenderRunner
)

for testing

Functions

func SetupStaticEnvOptions

func SetupStaticEnvOptions(cfg Config)

Types

type BuildEnvOpts

type BuildEnvOpts struct {
	Image        string
	PushImage    bool
	ImageRepo    string
	ImageTag     string
	BuildContext string
}

BuildEnvOpts contains the environment variables to be set in a build type lifecycle hook executor.

func NewBuildEnvOpts

func NewBuildEnvOpts(a *latest.Artifact, image string, pushImage bool) (BuildEnvOpts, error)

NewBuildEnvOpts returns `BuildEnvOpts` required to create a `Runner` for build lifecycle hooks

type Config

type Config interface {
	DefaultRepo() *string
	MultiLevelRepo() *bool
	GetWorkingDir() string
	RPCPort() *int
	RPCHTTPPort() *int
}

type DeployEnvOpts

type DeployEnvOpts struct {
	RunID       string
	KubeContext string
	Namespaces  string
}

DeployEnvOpts contains the environment variables to be set in a deploy type lifecycle hook executor.

func NewDeployEnvOpts

func NewDeployEnvOpts(runID string, kubeContext string, namespaces []string) DeployEnvOpts

type MockRunner

type MockRunner struct {
	PreHooks  func(ctx context.Context, out io.Writer) error
	PostHooks func(ctx context.Context, out io.Writer) error
}

MockRunner implements the Runner interface, to be used in unit tests

func (MockRunner) RunPostHooks

func (m MockRunner) RunPostHooks(ctx context.Context, out io.Writer) error

func (MockRunner) RunPreHooks

func (m MockRunner) RunPreHooks(ctx context.Context, out io.Writer) error

type RenderEnvOpts

type RenderEnvOpts struct {
	KubeContext string
	Namespaces  string
}

RenderEnvOpts contains the environment variables to be set in a deploy type lifecycle hook executor.

func NewRenderEnvOpts

func NewRenderEnvOpts(kubeContext string, namespaces []string) RenderEnvOpts

type Runner

type Runner interface {
	// RunPreHooks executes all pre-step hooks defined by the `Runner`
	RunPreHooks(ctx context.Context, out io.Writer) error
	// RunPostHooks executes all post-step hooks defined by the `Runner`
	RunPostHooks(ctx context.Context, out io.Writer) error
}

Runner represents a lifecycle hooks runner

func BuildRunner

func BuildRunner(d latest.BuildHooks, opts BuildEnvOpts) Runner

BuildRunner creates a new runner for pre-build and post-build lifecycle hooks

func NewSyncRunner

func NewSyncRunner(cli *kubectl.CLI, imageName, imageRef string, namespaces []string, formatter logger.Formatter, d latest.SyncHooks, opts SyncEnvOpts) Runner

type StaticEnvOpts

type StaticEnvOpts struct {
	DefaultRepo    *string
	MultiLevelRepo *bool
	RPCPort        *int
	HTTPPort       *int
	WorkDir        string
}

StaticEnvOpts contains the environment variables to be set in a lifecycle hook executor that don't change during the lifetime of the process.

type SyncEnvOpts

type SyncEnvOpts struct {
	Image                string
	BuildContext         string
	FilesAddedOrModified *string
	FilesDeleted         *string
	KubeContext          string
	Namespaces           string
}

SyncEnvOpts contains the environment variables to be set in a sync type lifecycle hook executor.

func NewSyncEnvOpts

func NewSyncEnvOpts(a *latest.Artifact, image string, addOrModifyFiles []string, deleteFiles []string, namespaces []string, kubeContext string) (SyncEnvOpts, error)

Jump to

Keyboard shortcuts

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