Documentation
¶
Index ¶
- Variables
- func LockContext(ctx context.Context, solver StateSolver, c *builddef.Context) (*builddef.Context, error)
- func ResolveImageOS(ctx context.Context, solver StateSolver, imageRef string) (builddef.OSRelease, error)
- type BuildkitSolver
- func (s BuildkitSolver) ExecImage(ctx context.Context, imageRef string, cmd []string) (*bytes.Buffer, error)
- func (s BuildkitSolver) FileExists(ctx context.Context, filepath string, source *builddef.Context) (bool, error)
- func (s BuildkitSolver) FromContext(source *builddef.Context, opts ...llb.LocalOption) ReadFileOpt
- func (s BuildkitSolver) FromImage(image string) ReadFileOpt
- func (s BuildkitSolver) ReadFile(ctx context.Context, filepath string, opt ReadFileOpt) ([]byte, error)
- func (s BuildkitSolver) ResolveImageRef(ctx context.Context, imageRef string) (string, error)
- type LocalSolver
- func (s LocalSolver) ExecImage(ctx context.Context, imageRef string, cmd []string) (*bytes.Buffer, error)
- func (s LocalSolver) FileExists(ctx context.Context, filepath string, source *builddef.Context) (bool, error)
- func (s LocalSolver) FromContext(source *builddef.Context, _ ...llb.LocalOption) ReadFileOpt
- func (s LocalSolver) FromImage(image string) ReadFileOpt
- func (s LocalSolver) ReadFile(ctx context.Context, filepath string, opt ReadFileOpt) ([]byte, error)
- func (s LocalSolver) ResolveImageRef(ctx context.Context, imageRef string) (string, error)
- type ReadFileOpt
- type StateSolver
Constants ¶
This section is empty.
Variables ¶
View Source
var (
FileNotFound = xerrors.New("file not found")
)
Functions ¶
func LockContext ¶
func ResolveImageOS ¶
func ResolveImageOS( ctx context.Context, solver StateSolver, imageRef string, ) (builddef.OSRelease, error)
ResolveImageOS reads /etc/os-release from a given image and parse it.
Types ¶
type BuildkitSolver ¶
type BuildkitSolver struct {
// contains filtered or unexported fields
}
func NewBuildkitSolver ¶
func NewBuildkitSolver(c client.Client) BuildkitSolver
func (BuildkitSolver) FileExists ¶
func (BuildkitSolver) FromContext ¶
func (s BuildkitSolver) FromContext( source *builddef.Context, opts ...llb.LocalOption, ) ReadFileOpt
func (BuildkitSolver) FromImage ¶
func (s BuildkitSolver) FromImage(image string) ReadFileOpt
func (BuildkitSolver) ReadFile ¶
func (s BuildkitSolver) ReadFile(ctx context.Context, filepath string, opt ReadFileOpt) ([]byte, error)
func (BuildkitSolver) ResolveImageRef ¶
type LocalSolver ¶
type LocalSolver struct {
Client *client.Client
Labels map[string]string
// RootDir is the path to the root of the build context.
RootDir string
ImageResolver remotes.Resolver
}
LocalSolver is the solver used by zbuild CLI tool. As such, it uses Docker to read files from images and resolve image references.
func (LocalSolver) FileExists ¶
func (LocalSolver) FromContext ¶
func (s LocalSolver) FromContext( source *builddef.Context, _ ...llb.LocalOption, ) ReadFileOpt
func (LocalSolver) FromImage ¶
func (s LocalSolver) FromImage(image string) ReadFileOpt
func (LocalSolver) ReadFile ¶
func (s LocalSolver) ReadFile( ctx context.Context, filepath string, opt ReadFileOpt, ) ([]byte, error)
func (LocalSolver) ResolveImageRef ¶
type StateSolver ¶
type StateSolver interface {
// ResolveImageRef takes a denormalized image reference (e.g. nginx:latest)
// and resolve it into a fully-qualified image reference with a digest. The
// returned image reference can be used in lockfiles.
// It returns an error if it can't resolve the image ref or if this method
// is not supported.
ResolveImageRef(ctx context.Context, imageRef string) (string, error)
// ExecImage is a method that execute a given command in the given image
// ref. It returns a byte buffer containing the command stdout. An error is
// returned if the executed command doesn't return an exit code = 0.
ExecImage(ctx context.Context, imageRef string, cmd []string) (*bytes.Buffer, error)
// FileExists check if the given filepath exists in the given context.
FileExists(ctx context.Context, filepath string, source *builddef.Context) (bool, error)
// ReadFile is the method to use to read a given file from either an image
// or a local source (see From methods). It returns the file content as a
// byte slice if it's found. If the path couldn't be found, it returns
// a FileNotFound error.
ReadFile(ctx context.Context, filepath string, opt ReadFileOpt) ([]byte, error)
FromContext(source *builddef.Context, opts ...llb.LocalOption) ReadFileOpt
// Fromimage returns a ReadFileOpt that can be used with the ReadFile
// method of the same solver to read a given path from an image.
FromImage(image string) ReadFileOpt
}
Click to show internal directories.
Click to hide internal directories.