Documentation ¶
Overview ¶
Package k6build defines a service for building k6 binaries
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrBuildFailed = errors.New("build failed") //nolint:revive
var ErrReasonUnknown = errors.New("reason unknown")
ErrReasonUnknown signals the reason for an WrappedError is unknown
Functions ¶
Types ¶
type Artifact ¶
type Artifact struct { // Unique id. Binaries satisfying the same set of dependencies have the same ID ID string `json:"id,omitempty"` // URL to fetch the artifact's binary URL string `json:"url,omitempty"` // List of dependencies that the artifact provides Dependencies map[string]string `json:"dependencies,omitempty"` // platform Platform string `json:"platform,omitempty"` // binary checksum (sha256) Checksum string `json:"checksum,omitempty"` }
Artifact defines the metadata of binary that satisfies a set of dependencies including a URL for downloading it.
func (Artifact) PrintSummary ¶ added in v0.3.1
PrintSummary returns a string with a pretty print of the artifact
type BuildService ¶
type BuildService interface { // Build returns a k6 Artifact that satisfies a set dependencies and version constrains. Build(ctx context.Context, platform string, k6Constrains string, deps []Dependency) (Artifact, error) }
BuildService defines the interface for building custom k6 binaries
type Dependency ¶
type Dependency struct { // Name is the name of the dependency. Name string `json:"name,omitempty"` // Constraints specifies the semantic version constraints. E.g. >v0.2.0 Constraints string `json:"constraints,omitempty"` }
Dependency defines a dependency and its semantic version constrains
type Module ¶
type Module struct { // Path is the go module path Path string `json:"path,omitempty"` // Version is the go module version Version string `json:"version,omitempty"` }
Module defines the mapping of a Dependency to a go module that satisfies it
type WrappedError ¶ added in v0.3.7
type WrappedError struct { Err error `json:"error,omitempty"` Reason error `json:"reason,omitempty"` }
WrappedError represents an error returned by the build service This custom error type facilitates extracting the reason of an error by using errors.Unwrap method. It also facilitates checking an error (or its reason) using errors.Is by comparing the error and its reason. This custom type has the following known limitations: - A nil WrappedError 'e' will not satisfy errors.Is(e, nil) - Is method will not
func AsError ¶ added in v0.3.7
func AsError(e error) (*WrappedError, bool)
AsError returns an error as an Error, if possible
func NewWrappedError ¶ added in v0.3.7
func NewWrappedError(err error, reason error) *WrappedError
NewWrappedError creates an Error from an error and a reason If the reason is nil, ErrReasonUnknown is used
func (*WrappedError) Error ¶ added in v0.3.7
func (e *WrappedError) Error() string
Error returns the Error as a string
func (*WrappedError) Is ¶ added in v0.3.7
func (e *WrappedError) Is(target error) bool
Is returns true if the target error is the same as the WrappedError or its reason It attempts several strategies: - compare error and reason to target's Error() - unwrap the error and reason and compare to target's WrappedError - unwrap target and compares to the error recursively
func (*WrappedError) MarshalJSON ¶ added in v0.3.7
func (e *WrappedError) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for the WrappedError type
func (*WrappedError) UnmarshalJSON ¶ added in v0.3.7
func (e *WrappedError) UnmarshalJSON(data []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for the WrappedError type
func (*WrappedError) Unwrap ¶ added in v0.3.7
func (e *WrappedError) Unwrap() error
Unwrap returns the underlying reason for the WrappedError
Directories ¶
Path | Synopsis |
---|---|
Package cmd contains build cobra command factory function.
|
Package cmd contains build cobra command factory function. |
k6build
package main implements the CLI root command for the k6build tool
|
package main implements the CLI root command for the k6build tool |
local
Package local implements the local build command
|
Package local implements the local build command |
remote
Package remote implements the client command
|
Package remote implements the client command |
server
Package server implements the build server command
|
Package server implements the build server command |
store
Package store implements the object store server command
|
Package store implements the object store server command |
pkg
|
|
api
Package api defines the interface to a build service
|
Package api defines the interface to a build service |
builder
Package builder implements a build service
|
Package builder implements a build service |
client
Package client implements a client for a build service
|
Package client implements a client for a build service |
local
Package local implements a local build service
|
Package local implements a local build service |
server
Package server implements a build server
|
Package server implements a build server |
store
Package store defines the interface of an object store service
|
Package store defines the interface of an object store service |
store/api
Package api defines the interface to a store server
|
Package api defines the interface to a store server |
store/client
Package client implements an object store service client
|
Package client implements an object store service client |
store/downloader
Package downloader implements utility functions for downloading objects from a store
|
Package downloader implements utility functions for downloading objects from a store |
store/file
Package file implements a file-backed object store
|
Package file implements a file-backed object store |
store/s3
Package s3 implements a s3-backed object store
|
Package s3 implements a s3-backed object store |
store/server
Package server implements an object store server
|
Package server implements an object store server |
util
Package util implements utility functions
|
Package util implements utility functions |
tools
|
|
gendoc
Package main contains CLI documentation generator tool.
|
Package main contains CLI documentation generator tool. |