Documentation
¶
Overview ¶
Package builds is a client for consuming Knative build templates.
Index ¶
- func BuildStatus(build build.Build) (finished bool, err error)
- func BuildpackTemplate() build.TemplateInstantiationSpec
- func PopulateTemplate(name string, template build.TemplateInstantiationSpec, opts ...CreateOption) *build.Build
- type BuildTailer
- type BuildTailerFunc
- type Client
- func (c *Client) Create(name string, template build.TemplateInstantiationSpec, opts ...CreateOption) (*build.Build, error)
- func (c *Client) Delete(name string, opts ...DeleteOption) error
- func (c *Client) Diagnose(d *doctor.Diagnostic)
- func (c *Client) Status(name string, opts ...StatusOption) (bool, error)
- func (c *Client) Tail(name string, opts ...TailOption) error
- type ClientInterface
- type CreateOption
- func WithCreateArgs(val map[string]string) CreateOption
- func WithCreateEnv(val []corev1.EnvVar) CreateOption
- func WithCreateNamespace(val string) CreateOption
- func WithCreateOwner(val *v1.OwnerReference) CreateOption
- func WithCreateServiceAccount(val string) CreateOption
- func WithCreateSourceImage(val string) CreateOption
- type CreateOptions
- func (opts CreateOptions) Args() map[string]string
- func (opts CreateOptions) Env() []corev1.EnvVar
- func (opts CreateOptions) Extend(other CreateOptions) CreateOptions
- func (opts CreateOptions) Namespace() string
- func (opts CreateOptions) Owner() *v1.OwnerReference
- func (opts CreateOptions) ServiceAccount() string
- func (opts CreateOptions) SourceImage() string
- type DeleteOption
- type DeleteOptions
- type StatusOption
- type StatusOptions
- type TailOption
- type TailOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildStatus ¶
BuildStatus gets the status of the given build. Complete will be set to true if the build has completed (or doesn't exist). Error will be set if the build completed with an error (or doesn't exist). A successful result is one that completed and error is nil.
func BuildpackTemplate ¶
func BuildpackTemplate() build.TemplateInstantiationSpec
BuildpackTemplate gets the template spec for the bulidpack template.
func PopulateTemplate ¶
func PopulateTemplate( name string, template build.TemplateInstantiationSpec, opts ...CreateOption, ) *build.Build
PopulateTemplate populates a build template for Client.Create. This method is public for debugging purposes so we can dry-run builds for users.
Types ¶
type BuildTailer ¶
type BuildTailer interface {
Tail(ctx context.Context, out io.Writer, buildName, namespace string) error
}
BuildTailer is implemented by github.com/knative/build/pkg/logs
type BuildTailerFunc ¶
BuildTailerFunc converts a func into a BuildTailer.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client to knative.Build built in a way that other systems could be mostly dropped in as replacements.
func (*Client) Create ¶
func (c *Client) Create(name string, template build.TemplateInstantiationSpec, opts ...CreateOption) (*build.Build, error)
Create creates a new build.
func (*Client) Delete ¶
func (c *Client) Delete(name string, opts ...DeleteOption) error
Delete removes a build.
func (*Client) Diagnose ¶
func (c *Client) Diagnose(d *doctor.Diagnostic)
type ClientInterface ¶
type ClientInterface interface { doctor.Diagnosable Create(name string, template build.TemplateInstantiationSpec, opts ...CreateOption) (*build.Build, error) Status(name string, opts ...StatusOption) (complete bool, err error) Delete(name string, opts ...DeleteOption) error Tail(name string, opts ...TailOption) error }
ClientInterface is the main interface for interacting with Knative builds.
It's built to be generic enough that we could swap in alternative implementations like Tekton without changing too much.
func NewClient ¶
func NewClient(buildClient cbuild.BuildV1alpha1Interface, buildTailer BuildTailer) ClientInterface
NewClient creates a new build client.
type CreateOption ¶
type CreateOption func(*createConfig)
CreateOption is a single option for configuring a createConfig
func WithCreateArgs ¶
func WithCreateArgs(val map[string]string) CreateOption
WithCreateArgs creates an Option that sets the arguments to the build template
func WithCreateEnv ¶
func WithCreateEnv(val []corev1.EnvVar) CreateOption
WithCreateEnv creates an Option that sets the environment variables that will be provided to the build
func WithCreateNamespace ¶
func WithCreateNamespace(val string) CreateOption
WithCreateNamespace creates an Option that sets the Kubernetes namespace to use
func WithCreateOwner ¶
func WithCreateOwner(val *v1.OwnerReference) CreateOption
WithCreateOwner creates an Option that sets a reference to the owner of this build
func WithCreateServiceAccount ¶
func WithCreateServiceAccount(val string) CreateOption
WithCreateServiceAccount creates an Option that sets the service account to run as
func WithCreateSourceImage ¶
func WithCreateSourceImage(val string) CreateOption
WithCreateSourceImage creates an Option that sets a Kontext source image to seed this build with
type CreateOptions ¶
type CreateOptions []CreateOption
CreateOptions is a configuration set defining a createConfig
func CreateOptionDefaults ¶
func CreateOptionDefaults() CreateOptions
CreateOptionDefaults gets the default values for Create.
func (CreateOptions) Args ¶
func (opts CreateOptions) Args() map[string]string
Args returns the last set value for Args or the empty value if not set.
func (CreateOptions) Env ¶
func (opts CreateOptions) Env() []corev1.EnvVar
Env returns the last set value for Env or the empty value if not set.
func (CreateOptions) Extend ¶
func (opts CreateOptions) Extend(other CreateOptions) CreateOptions
Extend creates a new CreateOptions with the contents of other overriding the values set in this CreateOptions.
func (CreateOptions) Namespace ¶
func (opts CreateOptions) Namespace() string
Namespace returns the last set value for Namespace or the empty value if not set.
func (CreateOptions) Owner ¶
func (opts CreateOptions) Owner() *v1.OwnerReference
Owner returns the last set value for Owner or the empty value if not set.
func (CreateOptions) ServiceAccount ¶
func (opts CreateOptions) ServiceAccount() string
ServiceAccount returns the last set value for ServiceAccount or the empty value if not set.
func (CreateOptions) SourceImage ¶
func (opts CreateOptions) SourceImage() string
SourceImage returns the last set value for SourceImage or the empty value if not set.
type DeleteOption ¶
type DeleteOption func(*deleteConfig)
DeleteOption is a single option for configuring a deleteConfig
func WithDeleteNamespace ¶
func WithDeleteNamespace(val string) DeleteOption
WithDeleteNamespace creates an Option that sets the Kubernetes namespace to use
type DeleteOptions ¶
type DeleteOptions []DeleteOption
DeleteOptions is a configuration set defining a deleteConfig
func DeleteOptionDefaults ¶
func DeleteOptionDefaults() DeleteOptions
DeleteOptionDefaults gets the default values for Delete.
func (DeleteOptions) Extend ¶
func (opts DeleteOptions) Extend(other DeleteOptions) DeleteOptions
Extend creates a new DeleteOptions with the contents of other overriding the values set in this DeleteOptions.
func (DeleteOptions) Namespace ¶
func (opts DeleteOptions) Namespace() string
Namespace returns the last set value for Namespace or the empty value if not set.
type StatusOption ¶
type StatusOption func(*statusConfig)
StatusOption is a single option for configuring a statusConfig
func WithStatusNamespace ¶
func WithStatusNamespace(val string) StatusOption
WithStatusNamespace creates an Option that sets the Kubernetes namespace to use
type StatusOptions ¶
type StatusOptions []StatusOption
StatusOptions is a configuration set defining a statusConfig
func StatusOptionDefaults ¶
func StatusOptionDefaults() StatusOptions
StatusOptionDefaults gets the default values for Status.
func (StatusOptions) Extend ¶
func (opts StatusOptions) Extend(other StatusOptions) StatusOptions
Extend creates a new StatusOptions with the contents of other overriding the values set in this StatusOptions.
func (StatusOptions) Namespace ¶
func (opts StatusOptions) Namespace() string
Namespace returns the last set value for Namespace or the empty value if not set.
type TailOption ¶
type TailOption func(*tailConfig)
TailOption is a single option for configuring a tailConfig
func WithTailContext ¶
func WithTailContext(val context.Context) TailOption
WithTailContext creates an Option that sets
func WithTailNamespace ¶
func WithTailNamespace(val string) TailOption
WithTailNamespace creates an Option that sets the Kubernetes namespace to use
func WithTailWriter ¶
func WithTailWriter(val io.Writer) TailOption
WithTailWriter creates an Option that sets
type TailOptions ¶
type TailOptions []TailOption
TailOptions is a configuration set defining a tailConfig
func TailOptionDefaults ¶
func TailOptionDefaults() TailOptions
TailOptionDefaults gets the default values for Tail.
func (TailOptions) Context ¶
func (opts TailOptions) Context() context.Context
Context returns the last set value for Context or the empty value if not set.
func (TailOptions) Extend ¶
func (opts TailOptions) Extend(other TailOptions) TailOptions
Extend creates a new TailOptions with the contents of other overriding the values set in this TailOptions.
func (TailOptions) Namespace ¶
func (opts TailOptions) Namespace() string
Namespace returns the last set value for Namespace or the empty value if not set.
func (TailOptions) Writer ¶
func (opts TailOptions) Writer() io.Writer
Writer returns the last set value for Writer or the empty value if not set.