Documentation ¶
Index ¶
- Variables
- type BuildDerivationOptions
- type Builder
- type CacheClient
- type Derivation
- func (drv Derivation) BuildDependencyGraph() (graph *dag.AcyclicGraph, err error)
- func (drv Derivation) Filename() (filename string)
- func (drv Derivation) Hash() string
- func (drv Derivation) JSON() []byte
- func (drv Derivation) PrettyJSON() string
- func (drv Derivation) RuntimeDependencyGraph() (graph *ds.AcyclicGraph, err error)
- type DerivationOutput
- type DerivationOutputs
- type ExecError
- type NewDerivationOptions
- type Output
- type OutputRequestBody
- type RunDerivationOptions
- type S3CacheClient
- type Source
- type SourceFiles
- type Store
- func (s *Store) CacheServer() http.Handler
- func (s *Store) LoadDerivation(filename string) (drv Derivation, found bool, err error)
- func (s *Store) NewBuilder(lockfileWriter types.LockfileWriter) *Builder
- func (s *Store) NewDerivation(options NewDerivationOptions) (exists bool, drv Derivation, err error)
- func (s *Store) RunDerivation(ctx context.Context, drv Derivation, opts RunDerivationOptions) (err error)
- func (s *Store) StoreLocalSources(ctx context.Context, sources SourceFiles) (out Source, err error)
- func (s *Store) UploadDerivationsToCache(ctx context.Context, derivations []Derivation, cc CacheClient) (err error)
- func (s *Store) WriteBlob(src io.Reader) (hash string, err error)
- func (s *Store) WriteConfigLink(location string) (err error)
- func (s *Store) WriteDerivation(drv Derivation) (filename string, err error)
Constants ¶
This section is empty.
Variables ¶
var ( PathPaddingCharacters = "bramble_store_padding" PathPaddingLength = 50 // BramblePrefixOfRecord is the prefix we use when hashing the build output // this allows us to get a consistent hash even if we're building in a // different location BramblePrefixOfRecord = "/home/bramble/bramble/bramble_store_padding/bramb" // TODO: could we make this more obviously fake? )
Functions ¶
This section is empty.
Types ¶
type BuildDerivationOptions ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func (*Builder) BuildDerivation ¶
func (b *Builder) BuildDerivation(ctx context.Context, drv Derivation, opts BuildDerivationOptions) (builtDrv Derivation, didBuild bool, err error)
type CacheClient ¶
type CacheClient interface { PostChunk(context.Context, io.Reader) (string, error) PostDerivation(context.Context, Derivation) (string, error) PostOutput(context.Context, OutputRequestBody) error }
func NewS3CacheClient ¶
func NewS3CacheClient(s3 *simples3.S3) CacheClient
type Derivation ¶
type Derivation struct { // Args are arguments that are passed to the builder Args []string // Builder will either be set to a string constant to signify an internal // builder (like "fetch_url"), or it will be set to the path of an // executable in the bramble store Builder string // Env are environment variables set during the build Env map[string]string // Dependencies are derivations that are using as imports to this build, // outputs dependencies are tracked in the outputs Dependencies DerivationOutputs // Name is the name of the derivation Name string Network bool `json:",omitempty"` // Outputs are build outputs, a derivation can have many outputs, the // default output is called "out". Multiple outputs are useful when your // build process can produce multiple artifacts, but building them as a // standalone derivation would involve a complete rebuild. // // This attribute is removed when hashing the derivation. OutputNames []string Outputs []Output // Platform is the platform we've built this derivation on Platform string Source Source // Target is the platform we've built this derivation for. If Target is // blank then the Platform value is the target. Target string `json:",omitempty"` // contains filtered or unexported fields }
Derivation is the basic building block of a Bramble build
func (Derivation) BuildDependencyGraph ¶
func (drv Derivation) BuildDependencyGraph() (graph *dag.AcyclicGraph, err error)
func (Derivation) Filename ¶
func (drv Derivation) Filename() (filename string)
func (Derivation) Hash ¶
func (drv Derivation) Hash() string
func (Derivation) JSON ¶
func (drv Derivation) JSON() []byte
func (Derivation) PrettyJSON ¶
func (drv Derivation) PrettyJSON() string
func (Derivation) RuntimeDependencyGraph ¶
func (drv Derivation) RuntimeDependencyGraph() (graph *ds.AcyclicGraph, err error)
RuntimeDependencyGraph graphs the full dependency graph needed at runtime for all outputs. Includes all immediate dependencies and their dependencies
type DerivationOutput ¶
DerivationOutput is one of the derivation inputs. Path is the location of the derivation, output is the name of the specific output this derivation uses for the build
type DerivationOutputs ¶
type DerivationOutputs []DerivationOutput
func (DerivationOutputs) Len ¶
func (dos DerivationOutputs) Len() int
func (DerivationOutputs) Less ¶
func (dos DerivationOutputs) Less(i, j int) bool
func (DerivationOutputs) Swap ¶
func (dos DerivationOutputs) Swap(i, j int)
type NewDerivationOptions ¶
type Output ¶
DerivationOutput tracks the build outputs. Outputs are not included in the Derivation hash. The path tracks the output location in the bramble store and Dependencies tracks the bramble outputs that are runtime dependencies.
type OutputRequestBody ¶
type OutputRequestBody struct { Output Output TOC []chunkedarchive.TOCEntry }
type RunDerivationOptions ¶
type S3CacheClient ¶
type S3CacheClient struct {
// contains filtered or unexported fields
}
func (*S3CacheClient) PostDerivation ¶
func (cc *S3CacheClient) PostDerivation(ctx context.Context, drv Derivation) (string, error)
func (*S3CacheClient) PostOutput ¶
func (cc *S3CacheClient) PostOutput(ctx context.Context, req OutputRequestBody) error
type SourceFiles ¶
type Store ¶
func (*Store) CacheServer ¶
Uploads a derivation and all outputs Sources aren't uploaded Outputs are uploaded in 4mb body chunks
func (*Store) LoadDerivation ¶
func (s *Store) LoadDerivation(filename string) (drv Derivation, found bool, err error)
func (*Store) NewBuilder ¶
func (s *Store) NewBuilder(lockfileWriter types.LockfileWriter) *Builder
func (*Store) NewDerivation ¶
func (s *Store) NewDerivation(options NewDerivationOptions) (exists bool, drv Derivation, err error)
func (*Store) RunDerivation ¶
func (s *Store) RunDerivation(ctx context.Context, drv Derivation, opts RunDerivationOptions) (err error)
func (*Store) StoreLocalSources ¶
func (*Store) UploadDerivationsToCache ¶
func (s *Store) UploadDerivationsToCache(ctx context.Context, derivations []Derivation, cc CacheClient) (err error)
func (*Store) WriteConfigLink ¶
func (*Store) WriteDerivation ¶
func (s *Store) WriteDerivation(drv Derivation) (filename string, err error)