Documentation ¶
Index ¶
- Variables
- func EmitSignature(ctx context.Context, signer ApkSigner, controlData []byte, sde time.Time) ([]byte, error)
- type ApkSigner
- type Build
- type CacheMembershipMap
- type Compiled
- type KeyApkSigner
- type Option
- func WithArch(arch apko_types.Architecture) Option
- func WithAuth(domain, user, pass string) Option
- func WithBinShOverlay(binShOverlay string) Option
- func WithBuildDate(s string) Option
- func WithCPU(cpu string) Option
- func WithCPUModel(cpumodel string) Option
- func WithCacheDir(cacheDir string) Option
- func WithCacheSource(sourceDir string) Option
- func WithConfig(configFile string) Option
- func WithConfigFileLicense(license string) Option
- func WithConfigFileRepositoryCommit(hash string) Option
- func WithConfigFileRepositoryURL(u string) Option
- func WithCreateBuildLog(createBuildLog bool) Option
- func WithDebug(debug bool) Option
- func WithDebugRunner(debug bool) Option
- func WithDependencyLog(logFile string) Option
- func WithDisk(disk string) Option
- func WithEmptyWorkspace(emptyWorkspace bool) Option
- func WithEnabledBuildOptions(enabledBuildOptions []string) Option
- func WithEnvFile(envFile string) Option
- func WithExtraKeys(extraKeys []string) Option
- func WithExtraPackages(extraPackages []string) Option
- func WithExtraRepos(extraRepos []string) Option
- func WithGenerateIndex(generateIndex bool) Option
- func WithGuestDir(guestDir string) Option
- func WithIgnoreSignatures(ignore bool) Option
- func WithInteractive(interactive bool) Option
- func WithLibcFlavorOverride(libc string) Option
- func WithLintRequire(linters []string) Option
- func WithLintWarn(linters []string) Option
- func WithMemory(memory string) Option
- func WithNamespace(namespace string) Option
- func WithOutDir(outDir string) Option
- func WithPackageCacheDir(apkCacheDir string) Option
- func WithPipelineDir(pipelineDir string) Option
- func WithRemove(remove bool) Option
- func WithRunner(runner container.Runner) Option
- func WithSigningKey(signingKey string) Option
- func WithSourceDir(sourceDir string) Option
- func WithStripOriginName(stripOriginName bool) Option
- func WithTimeout(dur time.Duration) Option
- func WithVarsFile(varsFile string) Option
- func WithWorkspaceDir(workspaceDir string) Option
- func WithWorkspaceIgnore(workspaceIgnore string) Option
- type PackageBuild
- func (pc *PackageBuild) AppendBuildLog(dir string) error
- func (pc *PackageBuild) EmitPackage(ctx context.Context) error
- func (pc *PackageBuild) Filename() string
- func (pc *PackageBuild) GenerateControlData(w io.Writer) error
- func (pc *PackageBuild) GenerateDependencies(ctx context.Context, hdl sca.SCAHandle) error
- func (pc *PackageBuild) Identity() string
- func (pc *PackageBuild) SignatureName() string
- func (pc *PackageBuild) Signer() ApkSigner
- func (pc *PackageBuild) WorkspaceSubdir() string
- type Runner
- type SBOMGroup
- type SCABuildInterface
- func (scabi *SCABuildInterface) BaseDependencies() config.Dependencies
- func (scabi *SCABuildInterface) Filesystem() (sca.SCAFS, error)
- func (scabi *SCABuildInterface) FilesystemForRelative(pkgName string) (sca.SCAFS, error)
- func (scabi *SCABuildInterface) Options() config.PackageOption
- func (scabi *SCABuildInterface) PackageName() string
- func (scabi *SCABuildInterface) RelativeNames() []string
- func (scabi *SCABuildInterface) Version() string
- type SubstitutionMap
- type Test
- func (t *Test) BuildGuest(ctx context.Context, imgConfig apko_types.ImageConfiguration, ...) (string, error)
- func (t *Test) Close() error
- func (t *Test) Compile(ctx context.Context) error
- func (t *Test) IsTestless() bool
- func (t *Test) OverlayBinSh(suffix string) error
- func (t *Test) PopulateCache(ctx context.Context) error
- func (t *Test) PopulateWorkspace(ctx context.Context, src fs.FS) error
- func (t *Test) Summarize(ctx context.Context)
- func (t *Test) SummarizePaths(ctx context.Context)
- func (t *Test) TestPackage(ctx context.Context) error
- type TestOption
- func WithExtraTestPackages(extraTestPackages []string) TestOption
- func WithTestArch(arch apko_types.Architecture) TestOption
- func WithTestAuth(domain, user, pass string) TestOption
- func WithTestBinShOverlay(binShOverlay string) TestOption
- func WithTestCacheDir(cacheDir string) TestOption
- func WithTestCacheSource(sourceDir string) TestOption
- func WithTestConfig(configFile string) TestOption
- func WithTestDebug(debug bool) TestOption
- func WithTestDebugRunner(debugRunner bool) TestOption
- func WithTestEnvFile(envFile string) TestOption
- func WithTestExtraKeys(extraKeys []string) TestOption
- func WithTestExtraRepos(extraRepos []string) TestOption
- func WithTestGuestDir(guestDir string) TestOption
- func WithTestInteractive(interactive bool) TestOption
- func WithTestPackage(pkg string) TestOption
- func WithTestPackageCacheDir(apkCacheDir string) TestOption
- func WithTestPipelineDir(pipelineDir string) TestOption
- func WithTestRemove(c bool) TestOption
- func WithTestRunner(runner container.Runner) TestOption
- func WithTestSourceDir(sourceDir string) TestOption
- func WithTestWorkspaceDir(workspaceDir string) TestOption
- func WithTestWorkspaceIgnore(workspaceIgnore string) TestOption
Constants ¶
This section is empty.
Variables ¶
var ErrSkipThisArch = errors.New("error: skip this arch")
Functions ¶
Types ¶
type Build ¶ added in v0.5.0
type Build struct { Configuration config.Configuration // The name of the build configuration file, e.g. "crane.yaml". ConfigFile string // The URL of the git repository where the build configuration file is stored, // e.g. "https://github.com/wolfi-dev/os". ConfigFileRepositoryURL string // The commit hash of the git repository corresponding to the current state of // the build configuration file. ConfigFileRepositoryCommit string // The SPDX license string to use for the build configuration file. ConfigFileLicense string SourceDateEpoch time.Time WorkspaceDir string WorkspaceIgnore string // Ordered directories where to find 'uses' pipelines. PipelineDirs []string SourceDir string GuestDir string SigningKey string SigningPassphrase string Namespace string GenerateIndex bool EmptyWorkspace bool OutDir string Arch apko_types.Architecture Libc string ExtraKeys []string ExtraRepos []string ExtraPackages []string DependencyLog string BinShOverlay string CreateBuildLog bool CacheDir string ApkCacheDir string CacheSource string StripOriginName bool EnvFile string VarsFile string Runner container.Runner Debug bool DebugRunner bool Interactive bool Remove bool LintRequire, LintWarn []string DefaultCPU string DefaultCPUModel string DefaultDisk string DefaultMemory string DefaultTimeout time.Duration Auth map[string]options.Auth IgnoreSignatures bool EnabledBuildOptions []string // Initialized in New and mutated throughout the build process as we gain // visibility into our packages' (including subpackages') composition. This is // how we get "build-time" SBOMs! SBOMGroup *SBOMGroup // contains filtered or unexported fields }
func (*Build) BuildPackage ¶ added in v0.5.0
func (*Build) Compile ¶ added in v0.9.0
Compile compiles all configuration, including tests, by loading any pipelines and substituting all variables.
func (*Build) SummarizePaths ¶ added in v0.5.0
type CacheMembershipMap ¶ added in v0.2.0
CacheMembershipMap describes a mapping where keys map to 'true' if present.
type Compiled ¶ added in v0.9.0
func (*Compiled) CompilePipelines ¶ added in v0.9.0
type KeyApkSigner ¶ added in v0.5.0
Key base signature (normal) uses a SHA-1 hash on the control digest.
func (KeyApkSigner) Sign ¶ added in v0.5.0
func (s KeyApkSigner) Sign(control []byte) ([]byte, error)
func (KeyApkSigner) SignatureName ¶ added in v0.5.0
func (s KeyApkSigner) SignatureName() string
type Option ¶
func WithArch ¶
func WithArch(arch apko_types.Architecture) Option
WithArch sets the build architecture to use for this build context.
func WithBinShOverlay ¶ added in v0.2.0
WithBinShOverlay sets a filename to copy from when installing /bin/sh into a build environment.
func WithBuildDate ¶
WithBuildDate sets the timestamps for the build context. The string is parsed according to RFC3339. An empty string is a special case and will default to the unix epoch.
func WithCPUModel ¶ added in v0.15.0
func WithCacheDir ¶ added in v0.2.0
WithCacheDir sets the cache directory to use.
func WithCacheSource ¶ added in v0.3.0
WithCacheSource sets the cache source directory to use. The cache will be pre-populated from this source directory.
func WithConfig ¶
WithConfig sets the configuration file used for the package build context.
func WithConfigFileLicense ¶ added in v0.14.0
func WithConfigFileRepositoryCommit ¶ added in v0.14.0
func WithConfigFileRepositoryURL ¶ added in v0.14.0
func WithCreateBuildLog ¶ added in v0.3.0
WithCreateBuildLog indicates whether to generate a package.log file containing the list of packages that were built. Some packages may have been skipped during the build if , so it can be hard to know exactly which packages were built
func WithDebug ¶ added in v0.3.0
WithDebug indicates whether debug logging of pipelines should be enabled.
func WithDebugRunner ¶ added in v0.5.0
WithDebugRunner indicates whether the runner should leave the build environment up on failures
func WithDependencyLog ¶ added in v0.2.0
WithDependencyLog sets a filename to use for dependency logging.
func WithEmptyWorkspace ¶
WithEmptyWorkspace sets whether the workspace should be empty.
func WithEnabledBuildOptions ¶ added in v0.3.0
WithEnabledBuildOptions takes an array of strings representing enabled build options. These options are referenced in the options block of the Configuration, and represent patches to the configured build process which are optionally applied.
func WithEnvFile ¶ added in v0.2.0
WithEnvFile specifies an environment file to use to preload the build environment. It should contain the CFLAGS and LDFLAGS used by the C toolchain as well as any other desired environment settings for the build environment.
func WithExtraKeys ¶
WithExtraKeys adds a set of extra keys to the build context.
func WithExtraPackages ¶ added in v0.6.2
WithExtraPackages specifies packages that are added to each build by default.
func WithExtraRepos ¶
WithExtraRepos adds a set of extra repos to the build context.
func WithGenerateIndex ¶ added in v0.2.0
WithGenerateIndex sets whether or not the apk index should be generated.
func WithGuestDir ¶ added in v0.2.0
WithGuestDir sets the guest directory to use.
func WithIgnoreSignatures ¶ added in v0.11.3
WithIgnoreIndexSignatures sets whether to ignore repository signature verification.
func WithInteractive ¶ added in v0.6.0
WithInteractive indicates whether to attach stdin and a tty to the runner on failures
func WithLibcFlavorOverride ¶ added in v0.9.0
WithLibcFlavorOverride sets the libc flavor for the build.
func WithLintRequire ¶ added in v0.10.0
WithLintRequire sets required linter checks.
func WithLintWarn ¶ added in v0.10.0
WithLintWarn sets non-required linter checks.
func WithMemory ¶ added in v0.5.4
func WithNamespace ¶ added in v0.3.0
WithNamespace takes a string to be used as the namespace in PackageURLs identifying the built apk in the generated SBOM. If no namespace is provided "unknown" will be listed as namespace.
func WithOutDir ¶
WithOutDir sets the output directory to use for the packages.
func WithPackageCacheDir ¶ added in v0.4.0
func WithPipelineDir ¶
WithPipelineDir sets the pipeline directory to extend the built-in pipeline directory. These are searched in order, so the first one found is used.
func WithRemove ¶ added in v0.5.8
WithRemove indicates whether the the build will clean up after itself. This includes deleting any intermediate artifacts like container images and temp workspace and guest dirs.
func WithRunner ¶ added in v0.4.0
WithRunner specifies what runner to use to wrap the build environment.
func WithSigningKey ¶
WithSigningKey sets the signing key path to use.
func WithSourceDir ¶
WithSourceDir sets the source directory to use.
func WithStripOriginName ¶ added in v0.2.0
WithStripOriginName determines whether the origin name should be stripped from generated packages. The APK solver uses origin names to flatten possible dependency nodes when solving for a DAG, which means that they should be stripped when building "bootstrap" repositories, as the cross-sysroot packages will be preferred over the native ones otherwise.
func WithTimeout ¶ added in v0.5.4
func WithVarsFile ¶ added in v0.3.0
WithVarsFile specifies a variables file to use to populate the build configuration variables block.
func WithWorkspaceDir ¶
WithWorkspaceDir sets the workspace directory to use.
func WithWorkspaceIgnore ¶
WithWorkspaceIgnore sets the workspace ignore rules file to use.
type PackageBuild ¶ added in v0.5.0
type PackageBuild struct { Build *Build Origin *config.Package PackageName string OriginName string InstalledSize int64 DataHash string OutDir string Dependencies config.Dependencies Arch string Options *config.PackageOption Scriptlets *config.Scriptlets Description string URL string Commit string }
func (*PackageBuild) AppendBuildLog ¶ added in v0.5.0
func (pc *PackageBuild) AppendBuildLog(dir string) error
AppendBuildLog will create or append a list of packages that were built by melange build
func (*PackageBuild) EmitPackage ¶ added in v0.5.0
func (pc *PackageBuild) EmitPackage(ctx context.Context) error
func (*PackageBuild) Filename ¶ added in v0.5.0
func (pc *PackageBuild) Filename() string
func (*PackageBuild) GenerateControlData ¶ added in v0.5.0
func (pc *PackageBuild) GenerateControlData(w io.Writer) error
func (*PackageBuild) GenerateDependencies ¶ added in v0.5.0
func (*PackageBuild) Identity ¶ added in v0.5.0
func (pc *PackageBuild) Identity() string
func (*PackageBuild) SignatureName ¶ added in v0.5.0
func (pc *PackageBuild) SignatureName() string
func (*PackageBuild) Signer ¶ added in v0.5.0
func (pc *PackageBuild) Signer() ApkSigner
func (*PackageBuild) WorkspaceSubdir ¶ added in v0.5.0
func (pc *PackageBuild) WorkspaceSubdir() string
type Runner ¶ added in v0.5.4
type Runner string
func GetAllRunners ¶ added in v0.4.0
func GetAllRunners() []Runner
GetAllRunners returns a list of all valid runners.
type SBOMGroup ¶ added in v0.14.0
type SBOMGroup struct {
// contains filtered or unexported fields
}
An SBOMGroup stores SBOMs corresponding to each package (or subpackage) within a build group. Its purpose is to let the build process easily manage SBOMs for the 1-N number of packages it ends up emitting.
func NewSBOMGroup ¶ added in v0.14.0
NewSBOMGroup creates a new SBOMGroup, initializing SBOMs for each package and subpackage name provided.
func (*SBOMGroup) AddBuildConfigurationPackage ¶ added in v0.14.0
AddBuildConfigurationPackage adds a package serving as the "build configuration package" to all SBOMs in the group.
func (*SBOMGroup) AddUpstreamSourcePackage ¶ added in v0.14.0
AddUpstreamSourcePackage adds a package serving as an "upstream source package" to all SBOMs in the group.
func (*SBOMGroup) Document ¶ added in v0.14.0
Document retrieves the SBOM for the given package or subpackage name.
func (*SBOMGroup) SetCreatedTime ¶ added in v0.14.0
SetCreatedTime sets the creation time for all SBOMs in the group.
func (*SBOMGroup) SetLicensingInfos ¶ added in v0.14.0
SetLicensingInfos sets the licensing information for all SBOMs in the group.
type SCABuildInterface ¶ added in v0.5.2
type SCABuildInterface struct { // PackageBuild represents the underlying package build object. PackageBuild *PackageBuild }
SCABuildInterface provides an implementation of SCAHandle which maps to a package build object.
func (*SCABuildInterface) BaseDependencies ¶ added in v0.5.2
func (scabi *SCABuildInterface) BaseDependencies() config.Dependencies
BaseDependencies returns the base dependencies for the package being built.
func (*SCABuildInterface) Filesystem ¶ added in v0.5.2
func (scabi *SCABuildInterface) Filesystem() (sca.SCAFS, error)
Filesystem implements an abstract filesystem providing access to a package filesystem.
func (*SCABuildInterface) FilesystemForRelative ¶ added in v0.5.2
func (scabi *SCABuildInterface) FilesystemForRelative(pkgName string) (sca.SCAFS, error)
FilesystemForRelative implements an abstract filesystem for any of the packages being built.
func (*SCABuildInterface) Options ¶ added in v0.5.2
func (scabi *SCABuildInterface) Options() config.PackageOption
Options returns the configured SCA engine options for the package being built.
func (*SCABuildInterface) PackageName ¶ added in v0.5.2
func (scabi *SCABuildInterface) PackageName() string
PackageName returns the currently built package name.
func (*SCABuildInterface) RelativeNames ¶ added in v0.5.2
func (scabi *SCABuildInterface) RelativeNames() []string
RelativeNames returns all the package names relating to the package being built.
func (*SCABuildInterface) Version ¶ added in v0.5.2
func (scabi *SCABuildInterface) Version() string
Version returns the version of the package being built including epoch.
type SubstitutionMap ¶ added in v0.9.0
func NewSubstitutionMap ¶ added in v0.9.0
func NewSubstitutionMap(cfg *config.Configuration, arch apko_types.Architecture, flavor string, buildOpts []string) (*SubstitutionMap, error)
func (*SubstitutionMap) MutateWith ¶ added in v0.9.0
func (*SubstitutionMap) Subpackage ¶ added in v0.9.0
func (sm *SubstitutionMap) Subpackage(subpkg *config.Subpackage) *SubstitutionMap
type Test ¶ added in v0.5.4
type Test struct { // Package to test. Package string Configuration config.Configuration ConfigFile string WorkspaceDir string WorkspaceIgnore string // Ordered directories where to find 'uses' pipelines. PipelineDirs []string SourceDir string GuestDir string Remove bool Arch apko_types.Architecture ExtraKeys []string ExtraRepos []string ExtraTestPackages []string BinShOverlay string CacheDir string ApkCacheDir string CacheSource string EnvFile string Runner container.Runner Debug bool DebugRunner bool Interactive bool Auth map[string]options.Auth IgnoreSignatures bool }
func (*Test) BuildGuest ¶ added in v0.5.4
func (t *Test) BuildGuest(ctx context.Context, imgConfig apko_types.ImageConfiguration, guestFS apkofs.FullFS) (string, error)
BuildGuest invokes apko to create the test image for the guest environment. imgConfig specifies the environment for the test to run (e.g. packages to install). Returns the imgRef for the created image, or error.
func (*Test) IsTestless ¶ added in v0.5.4
IsTestless returns true if the test context does not actually do any testing.
func (*Test) OverlayBinSh ¶ added in v0.5.4
func (*Test) PopulateCache ¶ added in v0.5.4
func (*Test) PopulateWorkspace ¶ added in v0.5.4
func (*Test) SummarizePaths ¶ added in v0.5.4
type TestOption ¶ added in v0.5.4
func WithExtraTestPackages ¶ added in v0.5.6
func WithExtraTestPackages(extraTestPackages []string) TestOption
WithExtraTestPackages specifies packages that are added to each test by default.
func WithTestArch ¶ added in v0.5.4
func WithTestArch(arch apko_types.Architecture) TestOption
WithTestArch sets the build architecture to use for this test context.
func WithTestAuth ¶ added in v0.8.4
func WithTestAuth(domain, user, pass string) TestOption
func WithTestBinShOverlay ¶ added in v0.5.4
func WithTestBinShOverlay(binShOverlay string) TestOption
WithTestBinShOverlay sets a filename to copy from when installing /bin/sh into a test environment.
func WithTestCacheDir ¶ added in v0.5.4
func WithTestCacheDir(cacheDir string) TestOption
WithCacheDir sets the cache directory to use.
func WithTestCacheSource ¶ added in v0.5.4
func WithTestCacheSource(sourceDir string) TestOption
WithCacheSource sets the cache source directory to use. The cache will be pre-populated from this source directory.
func WithTestConfig ¶ added in v0.5.4
func WithTestConfig(configFile string) TestOption
WithTestConfig sets the configuration file used for the package test context.
func WithTestDebug ¶ added in v0.5.4
func WithTestDebug(debug bool) TestOption
WithTestDebug indicates whether debug logging of pipelines should be enabled.
func WithTestDebugRunner ¶ added in v0.5.4
func WithTestDebugRunner(debugRunner bool) TestOption
func WithTestEnvFile ¶ added in v0.8.4
func WithTestEnvFile(envFile string) TestOption
WithTestEnvFile specifies an environment file to use to preload the build environment. It should contain the CFLAGS and LDFLAGS used by the C toolchain as well as any other desired environment settings for the build environment.
func WithTestExtraKeys ¶ added in v0.5.4
func WithTestExtraKeys(extraKeys []string) TestOption
WithTestExtraKeys adds a set of extra keys to the test context.
func WithTestExtraRepos ¶ added in v0.5.4
func WithTestExtraRepos(extraRepos []string) TestOption
WithTestExtraRepos adds a set of extra repos to the test context.
func WithTestGuestDir ¶ added in v0.5.4
func WithTestGuestDir(guestDir string) TestOption
WithGuestDir sets the guest directory to use.
func WithTestInteractive ¶ added in v0.6.0
func WithTestInteractive(interactive bool) TestOption
WithTestInteractive indicates whether to attach stdin and a tty to the runner on failures
func WithTestPackage ¶ added in v0.5.4
func WithTestPackage(pkg string) TestOption
WithTestPackage specifies the package to test.
func WithTestPackageCacheDir ¶ added in v0.5.4
func WithTestPackageCacheDir(apkCacheDir string) TestOption
func WithTestPipelineDir ¶ added in v0.5.4
func WithTestPipelineDir(pipelineDir string) TestOption
WithPipelineDir sets the pipeline directory to extend the built-in pipeline directory.
func WithTestRemove ¶ added in v0.13.7
func WithTestRemove(c bool) TestOption
If true, the test will clean up the test environment after the test is complete.
func WithTestRunner ¶ added in v0.5.4
func WithTestRunner(runner container.Runner) TestOption
WithTestRunner specifies what runner to use to wrap the test environment.
func WithTestSourceDir ¶ added in v0.5.4
func WithTestSourceDir(sourceDir string) TestOption
WithSourceDir sets the source directory to use.
func WithTestWorkspaceDir ¶ added in v0.5.4
func WithTestWorkspaceDir(workspaceDir string) TestOption
WithWorkspaceDir sets the workspace directory to use.
func WithTestWorkspaceIgnore ¶ added in v0.5.4
func WithTestWorkspaceIgnore(workspaceIgnore string) TestOption
WithWorkspaceIgnore sets the workspace ignore rules file to use.