Documentation
¶
Index ¶
- Variables
- func EmitSignature(ctx context.Context, signer ApkSigner, controlData []byte, sde time.Time) ([]byte, error)
- func GetAllRunners() []runner
- func GetDefaultRunner() runner
- func MutateWith(pb *PipelineBuild, with map[string]string) (map[string]string, error)
- type ApkSigner
- type Build
- func (b *Build) ApplyBuildOption(bo config.BuildOption) error
- func (b *Build) BuildFlavor() string
- func (b *Build) BuildGuest(ctx context.Context) error
- func (b *Build) BuildPackage(ctx context.Context) error
- func (b *Build) BuildTripletGnu() string
- func (b *Build) BuildTripletRust() string
- func (b *Build) IsBuildLess() bool
- func (b *Build) LoadIgnoreRules() error
- func (b *Build) OverlayBinSh() error
- func (b *Build) PopulateCache(ctx context.Context) error
- func (b *Build) PopulateWorkspace(ctx context.Context) error
- func (b *Build) RetrieveWorkspace(ctx context.Context) error
- func (b *Build) Summarize()
- func (b *Build) SummarizePaths()
- func (b *Build) WorkspaceConfig() *container.Config
- type CacheMembershipMap
- type DependencyGenerator
- type FulcioApkSigner
- type KeyApkSigner
- type Option
- func WithArch(arch apko_types.Architecture) Option
- func WithBinShOverlay(binShOverlay string) Option
- func WithBreakpointLabel(breakpointLabel string) Option
- func WithBuildDate(s string) Option
- func WithBuiltinPipelineDirectory(builtinPipelineDir string) Option
- func WithCacheDir(cacheDir string) Option
- func WithCacheSource(sourceDir string) Option
- func WithConfig(configFile string) Option
- func WithContinueLabel(continueLabel string) Option
- func WithCreateBuildLog(createBuildLog bool) Option
- func WithDebug(debug bool) Option
- func WithDebugRunner(debug bool) Option
- func WithDependencyLog(logFile string) Option
- func WithEmptyWorkspace(emptyWorkspace bool) Option
- func WithEnabledBuildOptions(enabledBuildOptions []string) Option
- func WithEnvFile(envFile string) Option
- func WithExtraKeys(extraKeys []string) Option
- func WithExtraRepos(extraRepos []string) Option
- func WithFailOnLintWarning(fail bool) Option
- func WithGenerateIndex(generateIndex bool) Option
- func WithGuestDir(guestDir string) Option
- func WithLogPolicy(policy []string) Option
- func WithNamespace(namespace string) Option
- func WithOutDir(outDir string) Option
- func WithPackageCacheDir(apkCacheDir string) Option
- func WithPipelineDir(pipelineDir string) Option
- func WithRunner(runner string) Option
- func WithSigningKey(signingKey string) Option
- func WithSourceDir(sourceDir string) Option
- func WithStripOriginName(stripOriginName bool) 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() error
- func (pc *PackageBuild) Identity() string
- func (pc *PackageBuild) SignatureName() string
- func (pc *PackageBuild) Signer() ApkSigner
- func (pc *PackageBuild) WorkspaceSubdir() string
- type PackageContext
- type PipelineBuild
- type PipelineContext
- type SubpackageContext
Constants ¶
This section is empty.
Variables ¶
var ErrSkipThisArch = errors.New("error: skip this arch")
Functions ¶
func EmitSignature ¶ added in v0.5.0
func GetAllRunners ¶ added in v0.4.0
func GetAllRunners() []runner
GetAllRunners returns a list of all valid runners.
func GetDefaultRunner ¶ added in v0.4.0
func GetDefaultRunner() runner
GetDefaultRunner returns the default runner to use. Currently, this is bubblewrap, but will be replaced with determining by platform.
func MutateWith ¶ added in v0.4.0
Types ¶
type Build ¶ added in v0.5.0
type Build struct { Configuration config.Configuration ConfigFile string SourceDateEpoch time.Time WorkspaceDir string WorkspaceIgnore string PipelineDir string BuiltinPipelineDir string SourceDir string GuestDir string SigningKey string SigningPassphrase string Namespace string GenerateIndex bool EmptyWorkspace bool OutDir string Logger apko_log.Logger Arch apko_types.Architecture ExtraKeys []string ExtraRepos []string DependencyLog string BinShOverlay string CreateBuildLog bool CacheDir string ApkCacheDir string CacheSource string BreakpointLabel string ContinueLabel string StripOriginName bool EnvFile string VarsFile string Runner container.Runner RunnerName string Debug bool DebugRunner bool LogPolicy []string FailOnLintWarning bool EnabledBuildOptions []string // contains filtered or unexported fields }
func (*Build) ApplyBuildOption ¶ added in v0.5.0
func (b *Build) ApplyBuildOption(bo config.BuildOption) error
ApplyBuildOption applies a patch described by a BuildOption to a package build.
func (*Build) BuildFlavor ¶ added in v0.5.0
BuildFlavor determines if a build context uses glibc or musl, it returns "gnu" for GNU systems, and "musl" for musl systems.
func (*Build) BuildGuest ¶ added in v0.5.0
BuildGuest invokes apko to build the guest environment.
func (*Build) BuildPackage ¶ added in v0.5.0
func (*Build) BuildTripletGnu ¶ added in v0.5.0
BuildTripletGnu returns the GNU autoconf build triplet, for example `x86_64-pc-linux-gnu`.
func (*Build) BuildTripletRust ¶ added in v0.5.0
BuildTripletRust returns the Rust/Cargo build triplet, for example `x86_64-unknown-linux-gnu`.
func (*Build) IsBuildLess ¶ added in v0.5.0
IsBuildLess returns true if the build context does not actually do any building. TODO(kaniini): Improve the heuristic for this by checking for uses/runs statements in the pipeline.
func (*Build) LoadIgnoreRules ¶ added in v0.5.0
func (*Build) OverlayBinSh ¶ added in v0.5.0
func (*Build) PopulateCache ¶ added in v0.5.0
func (*Build) PopulateWorkspace ¶ added in v0.5.0
func (*Build) RetrieveWorkspace ¶ added in v0.5.0
RetrieveWorkspace retrieves the workspace from the container and unpacks it to the workspace directory. The workspace retrieved from the runner is in a tar stream containing the workspace contents rooted at ./melange-out
func (*Build) SummarizePaths ¶ added in v0.5.0
func (b *Build) SummarizePaths()
func (*Build) WorkspaceConfig ¶ added in v0.5.0
type CacheMembershipMap ¶ added in v0.2.0
CacheMembershipMap describes a mapping where keys map to 'true' if present.
type DependencyGenerator ¶
type DependencyGenerator func(*PackageBuild, *config.Dependencies) error
type FulcioApkSigner ¶ added in v0.5.0
type FulcioApkSigner struct{}
APKv2+Fulcio style signature is an SHA-256 hash on the control digest. TODO(kaniini): Emit fulcio signature if signing key not configured.
func (*FulcioApkSigner) Sign ¶ added in v0.5.0
func (*FulcioApkSigner) Sign(control []byte) ([]byte, error)
Sign implements ApkSigner.
func (*FulcioApkSigner) SignatureName ¶ added in v0.5.0
func (*FulcioApkSigner) SignatureName() string
SignatureName implements ApkSigner.
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 WithBreakpointLabel ¶ added in v0.2.0
WithBreakpointLabel sets a label to stop build execution at. The build environment and workspace are preserved.
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 WithBuiltinPipelineDirectory ¶ added in v0.2.0
WithBuiltinPipelineDirectory sets the pipeline directory to use.
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 WithContinueLabel ¶ added in v0.2.0
WithContinueLabel sets a label to continue build execution from. This requires a preserved build environment and workspace.
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 WithExtraRepos ¶
WithExtraRepos adds a set of extra repos to the build context.
func WithFailOnLintWarning ¶ added in v0.5.0
WithFailOnLintWarning sets whether or not to fail on linter warnings.
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 WithLogPolicy ¶ added in v0.4.0
WithLogPolicy sets the logging policy to use during builds.
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.
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 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 *PackageContext PackageName string OriginName string InstalledSize int64 DataHash string OutDir string Logger log.Logger 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 (pc *PackageBuild) GenerateDependencies() error
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 PackageContext ¶
func NewPackageContext ¶ added in v0.5.0
func NewPackageContext(pkg *config.Package) (*PackageContext, error)
func (*PackageContext) Emit ¶ added in v0.5.0
func (pkg *PackageContext) Emit(ctx context.Context, pb *PipelineBuild) error
type PipelineBuild ¶ added in v0.5.0
type PipelineBuild struct { Build *Build Package *PackageContext Subpackage *SubpackageContext }
type PipelineContext ¶
func NewPipelineContext ¶ added in v0.5.0
func NewPipelineContextFromPipelineBuild ¶ added in v0.5.0
func NewPipelineContextFromPipelineBuild(pb *PipelineBuild) (*PipelineContext, error)
func (*PipelineContext) ApplyNeeds ¶ added in v0.5.0
func (pctx *PipelineContext) ApplyNeeds(pb *PipelineBuild) error
TODO(kaniini): Precompile pipeline before running / evaluating its needs.
func (*PipelineContext) Identity ¶ added in v0.5.0
func (pctx *PipelineContext) Identity() string
func (*PipelineContext) Run ¶ added in v0.5.0
func (pctx *PipelineContext) Run(ctx context.Context, pb *PipelineBuild) (bool, error)
type SubpackageContext ¶ added in v0.5.0
type SubpackageContext struct {
Subpackage *config.Subpackage
}
func NewSubpackageContext ¶ added in v0.5.0
func NewSubpackageContext(pkg *config.Subpackage) (*SubpackageContext, error)
Create a new subpackage context
func (*SubpackageContext) Emit ¶ added in v0.5.0
func (spkg *SubpackageContext) Emit(ctx context.Context, pb *PipelineBuild) error
func (SubpackageContext) ShouldRun ¶ added in v0.5.0
func (sp SubpackageContext) ShouldRun(pb *PipelineBuild) (bool, error)