hook

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package hook is the 1.0.0 hook configuration structure.

Index

Constants

View Source
const Version = "1.0.0"

Version is the hook configuration version defined in this package.

Variables

This section is empty.

Functions

This section is empty.

Types

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:"annotations,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.

Jump to

Keyboard shortcuts

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