debian-forge-composer/internal/pipeline/tar_assembler.go
Jacob Kozol a86e697171 distro: add custom image size
When creating a pipeline the assembler includes an image size. This
image size can be set when creating the pipeline but if it is 0 then a
default image size will be used. The default is 2 GB except for ami
images which are 6 GB.
2020-01-23 00:57:31 +01:00

36 lines
1.1 KiB
Go

package pipeline
// TarAssemblerOptions desrcibe how to assemble a tree into a tar ball.
//
// The assembler tars and optionally compresses the tree using the provided
// compression type, and stores the output with the given filename.
type TarAssemblerOptions struct {
Filename string `json:"filename"`
Size uint64 `json:"size"`
Compression string `json:"compression,omitempty"`
}
func (TarAssemblerOptions) isAssemblerOptions() {}
// NewTarAssemblerOptions creates a new TarAssemblerOptions object, with the
// mandatory options set.
func NewTarAssemblerOptions(filename string, size uint64) *TarAssemblerOptions {
return &TarAssemblerOptions{
Filename: filename,
Size: size,
}
}
// NewTarAssembler creates a new Tar Assembler object.
func NewTarAssembler(options *TarAssemblerOptions) *Assembler {
return &Assembler{
Name: "org.osbuild.tar",
Options: options,
}
}
// SetCompression sets the compression type for a given TarAssemblerOptions
// object.
func (options *TarAssemblerOptions) SetCompression(compression string) {
options.Compression = compression
}