Documentation
¶
Index ¶
- func AllImageFormats() []string
- func BootableImageFormats() []string
- func BuildNativePytestArgs(fs opctx.FS, pytestConfig *projectconfig.PytestConfig, ...) []string
- func InferImageFormat(imagePath string) (string, error)
- func NewImageBootCmd() *cobra.Command
- func NewImageBuildCmd() *cobra.Command
- func NewImageCustomizeCmd() *cobra.Command
- func NewImageInjectFilesCmd() *cobra.Command
- func NewImageListCommand() *cobra.Command
- func NewImageTestCmd() *cobra.Command
- func OnAppInit(app *azldev.App)
- func QEMUDriver(format string) string
- func ResolveImageByName(env *azldev.Env, imageName string) (*projectconfig.ImageConfig, error)
- func RunPytestSuite(env *azldev.Env, suiteConfig *projectconfig.TestSuiteConfig, ...) error
- type ImageArch
- type ImageBootOptions
- type ImageBuildOptions
- type ImageBuildResult
- type ImageDefinitionResult
- type ImageFormat
- type ImageListResult
- type ImageTestOptions
- type ListImageOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllImageFormats ¶ added in v0.2.0
func AllImageFormats() []string
AllImageFormats returns all supported image formats in priority order.
func BootableImageFormats ¶ added in v0.2.0
func BootableImageFormats() []string
BootableImageFormats returns the subset of image formats that can be booted in a VM.
func BuildNativePytestArgs ¶ added in v0.2.0
func BuildNativePytestArgs( fs opctx.FS, pytestConfig *projectconfig.PytestConfig, imageConfig *projectconfig.ImageConfig, options *ImageTestOptions, ) []string
BuildNativePytestArgs constructs the full pytest argument list from the config. Test paths are glob-expanded relative to the working directory using fs (so the expansion participates in the project's filesystem abstraction). Extra args are passed verbatim after placeholder substitution. The --junit-xml flag is appended automatically when requested via CLI.
func InferImageFormat ¶
InferImageFormat determines the image format from the file extension. Returns an error if the extension does not match a supported format.
func NewImageBootCmd ¶
NewImageBootCmd constructs a cobra.Command for the 'image boot' command.
func NewImageBuildCmd ¶
Constructs a cobra.Command for the 'image build' command.
func NewImageCustomizeCmd ¶
Constructs a cobra.Command for the 'project new' command.
func NewImageInjectFilesCmd ¶
Constructs a cobra.Command for the 'project new' command.
func NewImageListCommand ¶
Constructs a cobra.Command for "image list" CLI subcommand.
func NewImageTestCmd ¶
NewImageTestCmd constructs a cobra.Command for the 'image test' command.
func OnAppInit ¶
Called once when the app is initialized; registers any commands or callbacks with the app.
func QEMUDriver ¶
QEMUDriver returns the QEMU block driver name for the image format. Most formats use their string value directly, but some (e.g., vhd → vpc) require translation.
func ResolveImageByName ¶
func ResolveImageByName(env *azldev.Env, imageName string) (*projectconfig.ImageConfig, error)
ResolveImageByName is like resolveImage but includes a list of available images in the error message when the image is not found.
func RunPytestSuite ¶ added in v0.2.0
func RunPytestSuite( env *azldev.Env, suiteConfig *projectconfig.TestSuiteConfig, imageConfig *projectconfig.ImageConfig, options *ImageTestOptions, ) error
RunPytestSuite runs a pytest-based test suite natively using a Python venv.
Types ¶
type ImageArch ¶
type ImageArch string
ImageArch represents the architecture of an image, such as "x86_64" or "aarch64".
const ( // ImageArchDefault represents the default architecture (i.e., the host architecture). ImageArchDefault ImageArch = "" // ImageArchX86_64 represents the x86_64 architecture. ImageArchX86_64 ImageArch = "x86_64" // ImageArchAarch64 represents the aarch64 (a.k.a. arm64) architecture. ImageArchAarch64 ImageArch = "aarch64" )
type ImageBootOptions ¶
type ImageBootOptions struct {
// VM configuration (applies to all boot modes).
Arch qemu.Arch
SecureBoot bool
SSHPort uint16
CPUs int
Memory string
// Image source: at least one must be provided (unless '--iso' is used, in which case
// an empty disk is created if no image is specified).
ImageName string // Positional arg: look up image in project config to find its path.
ImagePath string // --image-path: explicit path to a disk image (overrides lookup).
Format ImageFormat // --format: explicit format hint for image-name lookup.
// --iso: bootable ISO (e.g., livecd, installer, rescue media). Attached as a
// bootable CD-ROM alongside the disk. Optional; independent of cloud-init.
ISOPath string
DiskSize string // --disk-size: size of the empty qcow2 created when '--iso' is used without a disk.
// Disk behavior.
UseDiskRW bool // --rwdisk: persist writes to the source disk image.
// Cloud-init configuration. If any credential is provided, a seed ISO is generated
// and attached. Whether the booted system consumes it depends on cloud-init being
// installed and enabled in the guest (same caveat applies to disk and ISO images).
TestUserName string
TestUserPassword string
TestUserPasswordFile string
AuthorizedPublicKeyPath string
}
ImageBootOptions contains options for the boot command.
type ImageBuildOptions ¶
type ImageBuildOptions struct {
// Name of the image to build.
ImageName string
// Paths to local repositories to include during build.
LocalRepoPaths []string
// URIs to remote repositories (http:// or https://) to include during build.
RemoteRepoPaths []string
// NoRemoteRepoGpgCheck disables GPG checking for all remote repositories
// specified via RemoteRepoPaths.
NoRemoteRepoGpgCheck bool
// RemoteRepoIncludeInImage marks all remote repositories specified via RemoteRepoPaths
// as part of the system image repository setup (imageinclude=true).
RemoteRepoIncludeInImage bool
// TargetArch specifies the target architecture to build for (e.g., "x86_64" or "aarch64").
// If left empty, the host architecture will be used.
TargetArch ImageArch
}
Options for building images.
type ImageBuildResult ¶
type ImageBuildResult struct {
// Name of the image that was built.
ImageName string `json:"imageName" table:",sortkey"`
// Path to the output directory containing the built image.
OutputDir string `json:"outputDir" table:"Output Dir"`
// Paths to the artifact files that were linked into the output directory.
ArtifactPaths []string `json:"artifactPaths" table:"Artifact Paths"`
}
ImageBuildResult summarizes the results of building an image.
func BuildImage ¶
func BuildImage(env *azldev.Env, options *ImageBuildOptions) (*ImageBuildResult, error)
BuildImage builds the specified image using kiwi-ng.
type ImageDefinitionResult ¶
type ImageDefinitionResult struct {
// Type indicates the type of image definition (e.g., "kiwi").
Type string `json:"type"`
// Path points to the image definition file.
Path string `json:"path"`
}
ImageDefinitionResult represents the definition details for an image.
type ImageFormat ¶
type ImageFormat string
ImageFormat represents a disk image or container image format.
const ( // ImageFormatRaw is the raw disk image format. ImageFormatRaw ImageFormat = "raw" // ImageFormatQcow2 is the QEMU copy-on-write v2 format. ImageFormatQcow2 ImageFormat = "qcow2" // ImageFormatVhd is the Hyper-V VHD format (QEMU driver: vpc). ImageFormatVhd ImageFormat = "vhd" // ImageFormatVhdx is the Hyper-V virtual hard disk format. ImageFormatVhdx ImageFormat = "vhdx" // ImageFormatOCI is an OCI container image tarball. ImageFormatOCI ImageFormat = "oci" )
func (*ImageFormat) Set ¶
func (f *ImageFormat) Set(value string) error
Set parses and validates the image format value from a string.
func (*ImageFormat) String ¶
func (f *ImageFormat) String() string
func (*ImageFormat) Type ¶
func (f *ImageFormat) Type() string
Type returns a descriptive string used in command-line help.
type ImageListResult ¶
type ImageListResult struct {
// Name of the image.
Name string `json:"name" table:",sortkey"`
// Description of the image.
Description string `json:"description"`
// Capabilities describes the features and properties of this image.
Capabilities projectconfig.ImageCapabilities `json:"capabilities" table:"-"`
// CapabilitiesSummary is a comma-separated summary of enabled capabilities for table
// display.
CapabilitiesSummary string `json:"-" table:"Capabilities"`
// Tests holds the test configuration for this image, matching the original config
// structure.
Tests projectconfig.ImageTestsConfig `json:"tests" table:"-"`
// TestsSummary is a comma-separated summary of test suite names for table display.
TestsSummary string `json:"-" table:"Tests"`
// Publish holds the publish settings for this image.
Publish projectconfig.ImagePublishConfig `json:"publish" table:"-"`
// PublishSummary is a comma-separated summary of publish channels for table display.
PublishSummary string `json:"-" table:"Publish"`
// Definition contains the image definition details (hidden from table output).
Definition ImageDefinitionResult `json:"definition" table:"-"`
}
ImageListResult represents an image in the list output.
func ListImages ¶
func ListImages(env *azldev.Env, options *ListImageOptions) ([]ImageListResult, error)
ListImages lists images in the env, in accordance with options. Returns the found images.
type ImageTestOptions ¶
type ImageTestOptions struct {
// ImageName is the name of the image (positional argument), used to look up its
// test suites and optionally resolve the image artifact path.
ImageName string
// TestSuites optionally selects specific test suites to run. When empty, all test
// suites associated with the image are run.
TestSuites []string
// ImagePath is an optional explicit path to the image file. When empty, the image
// artifact is resolved from the image name in the output directory.
ImagePath string
// JUnitXMLPath is an optional path for writing JUnit XML output.
JUnitXMLPath string
}
ImageTestOptions holds the options for the 'image test' command.
type ListImageOptions ¶
type ListImageOptions struct {
// Name patterns to filter images. Supports glob patterns (*, ?, []).
ImageNamePatterns []string
}
Options for listing images within the environment.