builderx

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ArchX8664 represents the x86_64 architecture
	ArchX8664 Architecture = "x86_64"
	// ArchAarch64 represents the aarch64 architecture
	ArchAarch64 Architecture = "aarch64"
	// ArchArmv7 represents the armv7 architecture
	ArchArmv7 Architecture = "armv7"
	// ArchPpc64le represents the ppc64le architecture
	ArchPpc64le Architecture = "ppc64le"
	// ArchS390x represents the s390x architecture
	ArchS390x Architecture = "s390x"
	// ApkoDefaultRepositoryURL is the default repository URL for APKO builds
	ApkoDefaultRepositoryURL = "cgr.dev/chainguard/apko"
	// ApkoWolfiSigninRsaKeyPath is the path to the Wolfi signing RSA public key used for package verification.
	ApkoWolfiSigninRsaKeyPath = "/etc/apk/keys/wolfi-signing.rsa.pub"
	// ApkoAlpineSigninRsaKeyPath is the path to the Alpine signing RSA public key used for package verification.
	ApkoAlpineSigninRsaKeyPath = "/etc/apk/keys/alpine-devel@lists.alpinelinux.org-4a6a0840.rsa.pub"
)

Variables

This section is empty.

Functions

func GetApkoConfigOrPreset added in v0.0.20

func GetApkoConfigOrPreset(mntPrefix, cfgFile string) (string, error)

GetApkoConfigOrPreset returns the configuration file path if it is valid. It takes two string parameters: 'mntPrefix' which is the mount prefix, and 'cfgFile' which is the configuration file path. If 'mntPrefix' is empty, it defaults to fixtures.MntPrefix. If 'cfgFile' is empty, it returns an error indicating that the config file is required. If 'cfgFile' does not have an extension, it returns an error indicating that the config file must have an extension. If 'cfgFile' does not have a .yaml or .yml extension, it returns an error indicating that the config file must have a .yaml or .yml extension. It returns the configuration file path if all checks pass, otherwise it returns an error.

func GetCacheDir

func GetCacheDir(mntPrefix string) string

GetCacheDir returns the APKO cache directory path. It takes a string parameter 'mntPrefix' which is the mount prefix. It returns the full path to the cache directory.

func GetOutputTarPath

func GetOutputTarPath(mntPrefix string) string

GetOutputTarPath returns the APKO output tar file path. It takes a string parameter 'mntPrefix' which is the mount prefix. It returns the full path to the output tar file.

Types

type ApkoBuilder

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

ApkoBuilder represents a builder for APKO (Alpine Package Keeper for OCI) images. It encapsulates all the configuration options and settings needed to build an APKO image.

func NewApkoBuilder

func NewApkoBuilder() *ApkoBuilder

NewApkoBuilder creates a new ApkoBuilder with default settings. It initializes the ApkoBuilder with default architectures "x86_64" and "aarch64".

func (*ApkoBuilder) BuildCommand

func (b *ApkoBuilder) BuildCommand() ([]string, error)

BuildCommand generates the APKO build command based on the current configuration of the ApkoBuilder. It returns a slice of strings representing the command and an error if any required fields are missing.

func (*ApkoBuilder) WithAlpineKeyring

func (b *ApkoBuilder) WithAlpineKeyring() *ApkoBuilder

WithAlpineKeyring adds the Alpine keyring to the APKO build. It sets the alpineKeyring field to true. It returns the updated ApkoBuilder instance.

func (*ApkoBuilder) WithAnnotations added in v0.0.21

func (b *ApkoBuilder) WithAnnotations(annotations map[string]string) *ApkoBuilder

WithAnnotations adds OCI annotations to the APKO build.

func (*ApkoBuilder) WithArchitecture

func (b *ApkoBuilder) WithArchitecture(arch string) *ApkoBuilder

WithArchitecture sets the build architecture for the APKO build. It takes a string parameter 'arch' which is the desired build architecture. It returns the updated ApkoBuilder instance.

func (*ApkoBuilder) WithBuildArch

func (b *ApkoBuilder) WithBuildArch(arch Architecture) *ApkoBuilder

WithBuildArch sets the build architecture for the APKO build. It takes an Architecture parameter 'arch' which is the desired build architecture. It returns the updated ApkoBuilder instance.

func (*ApkoBuilder) WithBuildContext

func (b *ApkoBuilder) WithBuildContext(dir string) *ApkoBuilder

WithBuildContext sets the build context directory

func (*ApkoBuilder) WithBuildDate added in v0.0.21

func (b *ApkoBuilder) WithBuildDate(date string) *ApkoBuilder

WithBuildDate sets the build date for the APKO build.

func (*ApkoBuilder) WithCacheDir

func (b *ApkoBuilder) WithCacheDir(cacheDir string) *ApkoBuilder

WithCacheDir sets the cache directory for the APKO build. It takes a string parameter 'cacheDir' which is the path to the cache directory. It returns the updated ApkoBuilder instance.

func (*ApkoBuilder) WithConfigFile

func (b *ApkoBuilder) WithConfigFile(configFile string) *ApkoBuilder

WithConfigFile sets the configuration file for the APKO build. It takes a string parameter 'configFile' which is the path to the configuration file. It returns the updated ApkoBuilder instance.

func (*ApkoBuilder) WithDebug

func (b *ApkoBuilder) WithDebug() *ApkoBuilder

WithDebug enables debug output

func (*ApkoBuilder) WithExtraArg

func (b *ApkoBuilder) WithExtraArg(arg string) *ApkoBuilder

WithExtraArg adds an extra argument to the APKO build command. It takes a string parameter 'arg' which is the extra argument to be added. It returns the updated ApkoBuilder instance.

func (*ApkoBuilder) WithKeyRingAlpine added in v0.0.19

func (b *ApkoBuilder) WithKeyRingAlpine() *ApkoBuilder

WithKeyRingAlpine adds the Alpine keyring to the APKO build. It appends the Alpine signing key to the keyringPaths. Returns the updated ApkoBuilder instance.

func (*ApkoBuilder) WithKeyRingWolfi added in v0.0.19

func (b *ApkoBuilder) WithKeyRingWolfi() *ApkoBuilder

WithKeyRingWolfi adds the Wolfi keyring to the APKO build. It appends the Wolfi signing key to the keyringPaths. Returns the updated ApkoBuilder instance.

func (*ApkoBuilder) WithKeyring

func (b *ApkoBuilder) WithKeyring(keyringPath string) *ApkoBuilder

WithKeyring adds a keyring path to the APKO build. It takes a string parameter 'keyringPath' which is the path to the keyring file. It returns the updated ApkoBuilder instance.

func (*ApkoBuilder) WithKeyringAppendPlaintext

func (b *ApkoBuilder) WithKeyringAppendPlaintext(keyring string) *ApkoBuilder

WithKeyringAppendPlaintext appends a plaintext keyring

func (*ApkoBuilder) WithLockfile added in v0.0.21

func (b *ApkoBuilder) WithLockfile(path string) *ApkoBuilder

WithLockfile sets the lockfile path for the APKO build.

func (*ApkoBuilder) WithLogLevel added in v0.0.21

func (b *ApkoBuilder) WithLogLevel(level string) *ApkoBuilder

WithLogLevel sets the log level for the APKO build.

func (*ApkoBuilder) WithLogPolicy added in v0.0.21

func (b *ApkoBuilder) WithLogPolicy(policies ...string) *ApkoBuilder

WithLogPolicy sets the log policy for the APKO build.

func (*ApkoBuilder) WithNoNetwork

func (b *ApkoBuilder) WithNoNetwork() *ApkoBuilder

WithNoNetwork disables network access during the build

func (*ApkoBuilder) WithOffline added in v0.0.21

func (b *ApkoBuilder) WithOffline() *ApkoBuilder

WithOffline enables offline mode for the APKO build.

func (*ApkoBuilder) WithOutputImage

func (b *ApkoBuilder) WithOutputImage(outputImage string) *ApkoBuilder

WithOutputImage sets the output image name for the APKO build. It takes a string parameter 'outputImage' which is the name of the output image. It returns the updated ApkoBuilder instance.

func (*ApkoBuilder) WithOutputTarball

func (b *ApkoBuilder) WithOutputTarball(outputTarball string) *ApkoBuilder

WithOutputTarball sets the output tarball path for the APKO build. It takes a string parameter 'outputTarball' which is the path to the output tarball. It returns the updated ApkoBuilder instance.

func (*ApkoBuilder) WithPackageAppend added in v0.0.21

func (b *ApkoBuilder) WithPackageAppend(packages ...string) *ApkoBuilder

WithPackageAppend adds extra packages to the APKO build.

func (*ApkoBuilder) WithRepositoryAppend

func (b *ApkoBuilder) WithRepositoryAppend(repo string) *ApkoBuilder

WithRepositoryAppend appends a repository to use for the build

func (*ApkoBuilder) WithSBOM added in v0.0.21

func (b *ApkoBuilder) WithSBOM(enable bool) *ApkoBuilder

WithSBOM enables or disables SBOM generation.

func (*ApkoBuilder) WithSBOMFormats added in v0.0.21

func (b *ApkoBuilder) WithSBOMFormats(formats ...string) *ApkoBuilder

WithSBOMFormats sets the SBOM formats for the APKO build.

func (*ApkoBuilder) WithSBOMPath added in v0.0.21

func (b *ApkoBuilder) WithSBOMPath(path string) *ApkoBuilder

WithSBOMPath sets the SBOM output path for the APKO build.

func (*ApkoBuilder) WithTag added in v0.0.20

func (b *ApkoBuilder) WithTag(tag ...string) *ApkoBuilder

WithTag adds a tag to the APKO build. If no tag is provided, it defaults to "latest". It returns the updated ApkoBuilder instance.

func (*ApkoBuilder) WithTimestamp

func (b *ApkoBuilder) WithTimestamp(timestamp string) *ApkoBuilder

WithTimestamp sets the timestamp for the build

func (*ApkoBuilder) WithVCS added in v0.0.21

func (b *ApkoBuilder) WithVCS(enable bool) *ApkoBuilder

WithVCS enables or disables VCS detection.

func (*ApkoBuilder) WithWolfiKeyring

func (b *ApkoBuilder) WithWolfiKeyring() *ApkoBuilder

WithWolfiKeyring adds the Wolfi keyring to the APKO build. It sets the wolfiKeyring field to true. It returns the updated ApkoBuilder instance.

func (*ApkoBuilder) WithWorkdir added in v0.0.21

func (b *ApkoBuilder) WithWorkdir(dir string) *ApkoBuilder

WithWorkdir sets the working directory for the APKO build.

type Architecture added in v0.0.20

type Architecture string

Architecture represents supported CPU architectures for APKO builds

type KeyringInfo added in v0.0.19

type KeyringInfo struct {
	KeyURL  string
	KeyPath string
}

KeyringInfo holds information about a keyring

func GetKeyringInfoForPreset added in v0.0.19

func GetKeyringInfoForPreset(preset string) (KeyringInfo, error)

GetKeyringInfoForPreset returns the keyring information based on the preset. It takes a string parameter 'preset' which specifies the keyring preset ("alpine" or "wolfi"). It returns a KeyringInfo struct and an error if the preset is unsupported.

Jump to

Keyboard shortcuts

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