Version: v0.6.1 Latest Latest

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

Go to latest
Published: Jun 1, 2018 License: Apache-2.0 Imports: 6 Imported by: 0



Package hook is the 1.0.0 hook configuration structure.



View Source
const Version = "1.0.0"

Version is the hook configuration version defined in this package.


This section is empty.


This section is empty.


type Hook

type Hook struct {
	Version string     `json:"version"`
	Hook    rspec.Hook `json:"hook"`
	When    When       `json:"when"`
	Stages  []string   `json:"stages"`

Hook is the hook configuration structure.

func Read

func Read(content []byte) (hook *Hook, err error)

Read reads hook JSON bytes, verifies them, and returns the hook configuration.

func (*Hook) Validate

func (hook *Hook) Validate(extensionStages []string) (err error)

Validate performs load-time hook validation.

type When

type When struct {
	Always        *bool             `json:"always,omitempty"`
	Annotations   map[string]string `json:"annotation,omitempty"`
	Commands      []string          `json:"commands,omitempty"`
	HasBindMounts *bool             `json:"hasBindMounts,omitempty"`

	// Or enables any-of matching.
	// Deprecated: this property is for is backwards-compatibility with
	// 0.1.0 hooks.  It will be removed when we drop support for them.
	Or bool `json:"-"`

When holds hook-injection conditions.

func (*When) Match

func (when *When) Match(config *rspec.Spec, annotations map[string]string, hasBindMounts bool) (match bool, err error)

Match returns true if the given conditions match the configuration.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL