builder

package
v1.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 23, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact struct {
	// contains filtered or unexported fields
}

Artifact represents the image produced by packer-builder-arm

func (*Artifact) BuilderId

func (a *Artifact) BuilderId() string

BuilderId returns builder ID

func (*Artifact) Destroy

func (a *Artifact) Destroy() error

Destroy removes the image from disk

func (*Artifact) Files

func (a *Artifact) Files() []string

Files returns list of images (in that case just one) built

func (*Artifact) Id

func (a *Artifact) Id() string

Id returns empty string

func (*Artifact) State

func (a *Artifact) State(_ string) interface{}

State N/A

func (*Artifact) String

func (a *Artifact) String() string

String returns the image path

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder builds (or modifies) arm system images

func NewBuilder

func NewBuilder() *Builder

NewBuilder default Builder constructor

func (*Builder) ConfigSpec

func (b *Builder) ConfigSpec() hcldec.ObjectSpec

ConfigSpec returns the config spec

func (*Builder) InitConfig

func (b *Builder) InitConfig(ctx *interpolate.Context) (warnings []string, errors []error)

InitConfig prepares relevant config structures

func (*Builder) Prepare

func (b *Builder) Prepare(args ...interface{}) ([]string, []string, error)

Prepare setup configuration (ex. ImageConfig)

func (*Builder) Run

func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (packer.Artifact, error)

Run executes steps in order to produce the system image

type Config

type Config struct {
	cfg.RemoteFileConfig `mapstructure:",squash"`
	cfg.ImageConfig      `mapstructure:",squash"`
	cfg.QemuConfig       `mapstructure:",squash"`
	// contains filtered or unexported fields
}

Config top-level holder for more specific configurations used while building packer-builder-arm

func (*Config) FlatMapstructure

func (*Config) FlatMapstructure() interface{ HCL2Spec() map[string]hcldec.Spec }

FlatMapstructure returns a new FlatConfig. FlatConfig is an auto-generated flat version of Config. Where the contents a fields with a `mapstructure:,squash` tag are bubbled up.

type FlatConfig

type FlatConfig struct {
	FileChecksum              *string                  `mapstructure:"file_checksum" required:"true" cty:"file_checksum" hcl:"file_checksum"`
	FileChecksumURL           *string                  `mapstructure:"file_checksum_url" cty:"file_checksum_url" hcl:"file_checksum_url"`
	FileChecksumType          *string                  `mapstructure:"file_checksum_type" cty:"file_checksum_type" hcl:"file_checksum_type"`
	FileUrls                  []string                 `mapstructure:"file_urls" cty:"file_urls" hcl:"file_urls"`
	FileUnarchiveCmd          []string                 `mapstructure:"file_unarchive_cmd" cty:"file_unarchive_cmd" hcl:"file_unarchive_cmd"`
	TargetPath                *string                  `mapstructure:"file_target_path" cty:"file_target_path" hcl:"file_target_path"`
	TargetExtension           *string                  `mapstructure:"file_target_extension" cty:"file_target_extension" hcl:"file_target_extension"`
	TmpDirLocation            *string                  `mapstructure:"file_tmp_dir_location" cty:"file_tmp_dir_location" hcl:"file_tmp_dir_location"`
	ImagePath                 *string                  `mapstructure:"image_path" required:"true" cty:"image_path" hcl:"image_path"`
	ImageSize                 *string                  `mapstructure:"image_size" cty:"image_size" hcl:"image_size"`
	ImageType                 *string                  `mapstructure:"image_type" cty:"image_type" hcl:"image_type"`
	ImageMountPath            *string                  `mapstructure:"image_mount_path" cty:"image_mount_path" hcl:"image_mount_path"`
	ImageBuildMethod          *string                  `mapstructure:"image_build_method" cty:"image_build_method" hcl:"image_build_method"`
	ImageSizeBytes            *uint64                  `mapstructure:"image_size_bytes" cty:"image_size_bytes" hcl:"image_size_bytes"`
	ImagePartitions           []config.FlatPartition   `mapstructure:"image_partitions" cty:"image_partitions" hcl:"image_partitions"`
	ImageChrootMounts         []config.FlatChrootMount `mapstructure:"image_chroot_mounts" cty:"image_chroot_mounts" hcl:"image_chroot_mounts"`
	AdditionalChrootMounts    []config.FlatChrootMount `mapstructure:"additional_chroot_mounts" cty:"additional_chroot_mounts" hcl:"additional_chroot_mounts"`
	ImageSetupExtra           [][]string               `mapstructure:"image_setup_extra" cty:"image_setup_extra" hcl:"image_setup_extra"`
	ImageChrootEnv            []string                 `mapstructure:"image_chroot_env" cty:"image_chroot_env" hcl:"image_chroot_env"`
	QemuBinarySourcePath      *string                  `mapstructure:"qemu_binary_source_path" required:"true" cty:"qemu_binary_source_path" hcl:"qemu_binary_source_path"`
	QemuBinaryDestinationPath *string                  `mapstructure:"qemu_binary_destination_path" cty:"qemu_binary_destination_path" hcl:"qemu_binary_destination_path"`
}

FlatConfig is an auto-generated flat version of Config. Where the contents of a field with a `mapstructure:,squash` tag are bubbled up.

func (*FlatConfig) HCL2Spec

func (*FlatConfig) HCL2Spec() map[string]hcldec.Spec

HCL2Spec returns the hcl spec of a Config. This spec is used by HCL to read the fields of Config. The decoded values from this spec will then be applied to a FlatConfig.

type StepChrootProvision

type StepChrootProvision struct {
	ImageMountPointKey string
	Hook               packer.Hook
	SetupQemu          bool
}

StepChrootProvision provisions the instance within a chroot

func (*StepChrootProvision) Cleanup

func (s *StepChrootProvision) Cleanup(_ multistep.StateBag)

Cleanup after step execution

func (*StepChrootProvision) Run

Run the step

type StepCompressArtifact

type StepCompressArtifact struct {
	ImageMountPointKey string
	// contains filtered or unexported fields
}

StepCompressArtifact generates rootfs archive if required

func (*StepCompressArtifact) Cleanup

func (s *StepCompressArtifact) Cleanup(_ multistep.StateBag)

Cleanup after step execution

func (*StepCompressArtifact) Run

Run the step

type StepCreateBaseImage

type StepCreateBaseImage struct{}

StepCreateBaseImage creates the base image (empty file of given size via dd)

func (*StepCreateBaseImage) Cleanup

func (s *StepCreateBaseImage) Cleanup(_ multistep.StateBag)

Cleanup after step execution

func (*StepCreateBaseImage) Run

Run the step

type StepExpandPartition

type StepExpandPartition struct {
	ResultKey string
}

StepExpandPartition expand already partitioned image

func (*StepExpandPartition) Cleanup

func (s *StepExpandPartition) Cleanup(_ multistep.StateBag)

Cleanup after step execution

func (*StepExpandPartition) Run

Run the step

type StepExtractAndCopyImage

type StepExtractAndCopyImage struct {
	FromKey string
}

StepExtractAndCopyImage creates filesystem on already partitioned image

func (*StepExtractAndCopyImage) Cleanup

Cleanup after step execution

func (*StepExtractAndCopyImage) Run

Run the step

type StepMapImage

type StepMapImage struct {
	ResultKey string
	// contains filtered or unexported fields
}

StepMapImage maps system image to /dev/loopX

func (*StepMapImage) Cleanup

func (s *StepMapImage) Cleanup(state multistep.StateBag)

Cleanup after step execution

func (*StepMapImage) Run

Run the step

type StepMkfsImage

type StepMkfsImage struct {
	FromKey string
}

StepMkfsImage creates filesystem on already partitioned image

func (*StepMkfsImage) Cleanup

func (s *StepMkfsImage) Cleanup(_ multistep.StateBag)

Cleanup after step execution

func (*StepMkfsImage) Run

Run the step

type StepMountImage

type StepMountImage struct {
	FromKey   string
	ResultKey string
	MountPath string
	// contains filtered or unexported fields
}

StepMountImage mounts partition to selected mountpoints

func (*StepMountImage) Cleanup

func (s *StepMountImage) Cleanup(state multistep.StateBag)

Cleanup after step execution

func (*StepMountImage) Run

Run the step

type StepPartitionImage

type StepPartitionImage struct{}

StepPartitionImage creates partitions on raw image

func (*StepPartitionImage) Cleanup

func (s *StepPartitionImage) Cleanup(_ multistep.StateBag)

Cleanup after step execution

func (*StepPartitionImage) Run

Run the step

type StepPopulateFilesystem

type StepPopulateFilesystem struct {
	RootfsArchiveKey   string
	ImageMountPointKey string
}

StepPopulateFilesystem unpacks system files from previously downloaded archive onto mounted partitions

func (*StepPopulateFilesystem) Cleanup

Cleanup after step execution

func (*StepPopulateFilesystem) Run

Run the step

type StepResizePartitionFs

type StepResizePartitionFs struct {
	FromKey              string
	SelectedPartitionKey string
}

StepResizePartitionFs expand already partitioned image

func (*StepResizePartitionFs) Cleanup

Cleanup after step execution

func (*StepResizePartitionFs) Run

Run the step

type StepResizeQemuImage

type StepResizeQemuImage struct {
}

StepResizeQemuImage expand already partitioned image

func (*StepResizeQemuImage) Cleanup

func (s *StepResizeQemuImage) Cleanup(_ multistep.StateBag)

Cleanup after step execution

func (*StepResizeQemuImage) Run

Run the step

type StepSetupChroot

type StepSetupChroot struct {
	ImageMountPointKey string
}

StepSetupChroot prepares chroot environment by mounting specific locations (/dev /proc etc.)

func (*StepSetupChroot) Cleanup

func (s *StepSetupChroot) Cleanup(state multistep.StateBag)

Cleanup after step execution

func (*StepSetupChroot) Run

Run the step

type StepSetupExtra

type StepSetupExtra struct {
	FromKey string
}

StepSetupExtra creates filesystem on already partitioned image

func (*StepSetupExtra) Cleanup

func (s *StepSetupExtra) Cleanup(_ multistep.StateBag)

Cleanup after step execution

func (*StepSetupExtra) Run

Run the step

type StepSetupQemu

type StepSetupQemu struct {
	ImageMountPointKey string
}

StepSetupQemu configures chroot environment to run binaries via qemu

func (*StepSetupQemu) Cleanup

func (s *StepSetupQemu) Cleanup(state multistep.StateBag)

Cleanup after step execution

func (*StepSetupQemu) Run

Run the step

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL