Documentation ¶
Index ¶
- type Advisories
- type AdvisoryContent
- type BuildOption
- type CacheMembershipMap
- type Configuration
- type ConfigurationParsingOption
- type ContentsOption
- type Context
- func (ctx *Context) BuildAndPushLocalImage(bc *apko_build.Context) error
- func (ctx *Context) BuildFlavor() string
- func (ctx *Context) BuildGuest() error
- func (ctx *Context) BuildPackage() error
- func (ctx *Context) BuildTripletGnu() string
- func (ctx *Context) BuildTripletRust() string
- func (ctx *Context) GenerateBuildLog(dir string) error
- func (ctx *Context) LoadIgnoreRules() error
- func (ctx *Context) OverlayBinSh() error
- func (ctx *Context) PopulateCache() error
- func (ctx *Context) PopulateWorkspace() error
- func (ctx *Context) Summarize()
- func (ctx *Context) SummarizePaths()
- func (ctx *Context) WorkspaceConfig() *container.Config
- type Copyright
- type DataItem
- type DataItemList
- type Dependencies
- type DependencyGenerator
- type EnvironmentOption
- type GitHubMonitor
- type Input
- type ListOption
- type Logger
- type Needs
- 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 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 WithGenerateIndex(generateIndex bool) Option
- func WithGuestDir(guestDir string) Option
- func WithNamespace(namespace string) Option
- func WithOutDir(outDir string) Option
- func WithPipelineDir(pipelineDir 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 Package
- type PackageContext
- func (pc *PackageContext) EmitPackage() error
- func (pc *PackageContext) Filename() string
- func (pc *PackageContext) GenerateControlData(w io.Writer) error
- func (pc *PackageContext) GenerateDependencies() error
- func (pc *PackageContext) Identity() string
- func (pc *PackageContext) SignatureName() string
- func (pc *PackageContext) WorkspaceSubdir() string
- type PackageOption
- type Pipeline
- type PipelineAssertions
- type PipelineContext
- type RangeData
- type ReleaseMonitor
- type SBOM
- type Scriptlets
- type Secfixes
- type Subpackage
- type Update
- type VarTransforms
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advisories ¶ added in v0.3.0
type Advisories map[string][]AdvisoryContent
type AdvisoryContent ¶ added in v0.3.0
type AdvisoryContent struct { Timestamp time.Time `yaml:"timestamp"` Status vex.Status `yaml:"status"` Justification vex.Justification `yaml:"justification,omitempty"` ImpactStatement string `yaml:"impact,omitempty"` ActionStatement string `yaml:"action,omitempty"` FixedVersion string `yaml:"fixed-version,omitempty"` }
func (AdvisoryContent) Validate ¶ added in v0.3.0
func (ac AdvisoryContent) Validate() error
type BuildOption ¶ added in v0.3.0
type BuildOption struct { Vars map[string]string `yaml:"vars,omitempty"` Environment EnvironmentOption `yaml:"environment,omitempty"` }
BuildOption describes an optional deviation to a package build.
func (BuildOption) Apply ¶ added in v0.3.0
func (bo BuildOption) Apply(ctx *Context) error
Apply applies a patch described by a BuildOption to a package build.
type CacheMembershipMap ¶ added in v0.2.0
CacheMembershipMap describes a mapping where keys map to 'true' if present.
type Configuration ¶
type Configuration struct { Package Package Environment apko_types.ImageConfiguration Pipeline []Pipeline `yaml:"pipeline,omitempty"` Subpackages []Subpackage `yaml:"subpackages,omitempty"` Data []RangeData `yaml:"data,omitempty"` Secfixes Secfixes `yaml:"secfixes,omitempty"` Advisories Advisories `yaml:"advisories,omitempty"` Update Update `yaml:"update,omitempty"` Vars map[string]string `yaml:"vars,omitempty"` VarTransforms []VarTransforms `yaml:"var-transforms,omitempty"` Options map[string]BuildOption `yaml:"options,omitempty"` }
func ParseConfiguration ¶ added in v0.3.0
func ParseConfiguration(configurationFilePath string, opts ...ConfigurationParsingOption) (*Configuration, error)
ParseConfiguration returns a decoded build Configuration using the parsing options provided.
func (*Configuration) Load ¶
func (cfg *Configuration) Load(ctx Context) error
Load the configuration data from the build context configuration file.
func (Configuration) PackageURLs ¶ added in v0.3.0
func (cfg Configuration) PackageURLs(distro string) []string
PackageURLs returns a list of package URLs ("purls") for the given configuration. The first PURL is always the origin package, and any subsequent items are the PURLs for the Configuration's subpackages. For more information on PURLs, see https://github.com/package-url/purl-spec#purl.
type ConfigurationParsingOption ¶ added in v0.3.0
type ConfigurationParsingOption func(*configOptions)
func WithEnvFileForParsing ¶ added in v0.3.0
func WithEnvFileForParsing(path string) ConfigurationParsingOption
WithEnvFileForParsing set the paths from whcih to read an environment file.
func WithFS ¶ added in v0.3.0
func WithFS(filesystem fs.FS) ConfigurationParsingOption
WithFS sets the fs.FS implementation to use. So far this FS is used only for reading the configuration file. If not provided, the default FS will be an os.DirFS created from the configuration file's containing directory.
func WithLogger ¶ added in v0.3.0
func WithLogger(logger Logger) ConfigurationParsingOption
WithLogger sets the logger to use during configuration parsing. This is optional, and if not supplied, a no-op logger will be used.
func WithVarsFileForParsing ¶ added in v0.3.0
func WithVarsFileForParsing(path string) ConfigurationParsingOption
WithVarsFileForParsing sets the path to the vars file to use if the user wishes to populate the variables block from an external file.
type ContentsOption ¶ added in v0.3.0
type ContentsOption struct {
Packages ListOption `yaml:"packages,omitempty"`
}
ContentsOption describes an optional deviation to an apko environment's contents block.
type Context ¶
type Context struct { Configuration 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 *log.Logger Arch apko_types.Architecture ExtraKeys []string ExtraRepos []string DependencyLog string BinShOverlay string CreateBuildLog bool CacheDir string CacheSource string BreakpointLabel string ContinueLabel string StripOriginName bool EnvFile string VarsFile string Runner container.Runner Debug bool EnabledBuildOptions []string // contains filtered or unexported fields }
func (*Context) BuildAndPushLocalImage ¶ added in v0.2.0
func (ctx *Context) BuildAndPushLocalImage(bc *apko_build.Context) error
BuildAndPushLocalImage uses apko to build and push the image to the local Docker daemon.
func (*Context) BuildFlavor ¶ added in v0.2.0
BuildFlavor determines if a build context uses glibc or musl, it returns "gnu" for GNU systems, and "musl" for musl systems.
func (*Context) BuildGuest ¶ added in v0.2.0
BuildGuest invokes apko to build the guest environment.
func (*Context) BuildPackage ¶
func (*Context) BuildTripletGnu ¶ added in v0.2.0
BuildTripletGnu returns the GNU autoconf build triplet, for example `x86_64-pc-linux-gnu`.
func (*Context) BuildTripletRust ¶ added in v0.2.0
BuildTripletRust returns the Rust/Cargo build triplet, for example `x86_64-unknown-linux-gnu`.
func (*Context) GenerateBuildLog ¶ added in v0.3.0
GenerateBuildLog will create or append a list of packages that were built by melange build
func (*Context) LoadIgnoreRules ¶
func (*Context) OverlayBinSh ¶ added in v0.2.0
func (*Context) PopulateCache ¶ added in v0.2.0
func (*Context) PopulateWorkspace ¶
func (*Context) SummarizePaths ¶ added in v0.2.0
func (ctx *Context) SummarizePaths()
func (*Context) WorkspaceConfig ¶ added in v0.2.0
type DataItemList ¶ added in v0.2.0
type DataItemList []DataItem
func (*DataItemList) MarshalYAML ¶ added in v0.2.0
func (d *DataItemList) MarshalYAML() (interface{}, error)
func (*DataItemList) UnmarshalYAML ¶ added in v0.2.0
func (d *DataItemList) UnmarshalYAML(n *yaml.Node) error
type Dependencies ¶
type Dependencies struct { Runtime []string `yaml:"runtime,omitempty"` Provides []string `yaml:"provides,omitempty"` Replaces []string `yaml:"replaces,omitempty"` ProviderPriority int `yaml:"provider-priority,omitempty"` }
func (*Dependencies) Summarize ¶
func (dep *Dependencies) Summarize(logger *log.Logger)
type DependencyGenerator ¶
type DependencyGenerator func(*PackageContext, *Dependencies) error
type EnvironmentOption ¶ added in v0.3.0
type EnvironmentOption struct {
Contents ContentsOption `yaml:"contents,omitempty"`
}
EnvironmentOption describes an optional deviation to an apko environment.
type GitHubMonitor ¶ added in v0.3.0
type GitHubMonitor struct { Identifier string `yaml:"identifier"` // org/repo for GitHub StripPrefix string `yaml:"strip-prefix,omitempty"` // if the version in GitHub contains a prefix which needs to be stripped when updating the melange package TagFilter string `yaml:"tag-filter,omitempty"` // filter to apply when searching tags on a GitHub repository UseTags bool `yaml:"use-tag,omitempty"` // override the default of using a GitHub release to identify related tag to fetch. Not all projects use GitHub releases but just use tags }
GitHubMonitor indicates using the GitHub API
type ListOption ¶ added in v0.3.0
type ListOption struct { Add []string `yaml:"add,omitempty"` Remove []string `yaml:"remove,omitempty"` }
ListOption describes an optional deviation to a list, for example, a list of packages.
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 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 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 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 WithPipelineDir ¶
WithPipelineDir sets the pipeline directory to extend the built-in pipeline directory.
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 Package ¶
type Package struct { Name string `yaml:"name"` Version string `yaml:"version"` Epoch uint64 `yaml:"epoch"` Description string `yaml:"description,omitempty"` URL string `yaml:"url,omitempty"` Commit string `yaml:"commit,omitempty"` TargetArchitecture []string `yaml:"target-architecture,omitempty"` Copyright []Copyright `yaml:"copyright,omitempty"` Dependencies Dependencies `yaml:"dependencies,omitempty"` Options PackageOption `yaml:"options,omitempty"` Scriptlets Scriptlets `yaml:"scriptlets,omitempty"` }
func (*Package) Emit ¶
func (pkg *Package) Emit(ctx *PipelineContext) error
func (*Package) FullCopyright ¶ added in v0.2.0
FullCopyright returns the concatenated copyright expressions defined in the configuration file.
func (*Package) LicenseExpression ¶ added in v0.2.0
LicenseExpression returns an SPDX license expression formed from the data in the copyright structs found in the conf. Its a simple OR for now.
func (Package) PackageURL ¶ added in v0.3.0
PackageURL returns the package URL ("purl") for the package. For more information, see https://github.com/package-url/purl-spec#purl.
type PackageContext ¶
type PackageContext struct { Context *Context Origin *Package PackageName string OriginName string InstalledSize int64 DataHash string OutDir string Logger *log.Logger Dependencies Dependencies Arch string Options PackageOption Scriptlets Scriptlets Description string URL string Commit string }
func (*PackageContext) EmitPackage ¶
func (pc *PackageContext) EmitPackage() error
func (*PackageContext) Filename ¶
func (pc *PackageContext) Filename() string
func (*PackageContext) GenerateControlData ¶
func (pc *PackageContext) GenerateControlData(w io.Writer) error
func (*PackageContext) GenerateDependencies ¶
func (pc *PackageContext) GenerateDependencies() error
func (*PackageContext) Identity ¶
func (pc *PackageContext) Identity() string
func (*PackageContext) SignatureName ¶
func (pc *PackageContext) SignatureName() string
func (*PackageContext) WorkspaceSubdir ¶
func (pc *PackageContext) WorkspaceSubdir() string
type PackageOption ¶ added in v0.2.0
type Pipeline ¶
type Pipeline struct { Name string `yaml:"name,omitempty"` Uses string `yaml:"uses,omitempty"` With map[string]string `yaml:"with,omitempty"` Runs string `yaml:"runs,omitempty"` Pipeline []Pipeline `yaml:"pipeline,omitempty"` Inputs map[string]Input `yaml:"inputs,omitempty"` Needs Needs `yaml:"needs,omitempty"` Label string `yaml:"label,omitempty"` If string `yaml:"if,omitempty"` Assertions PipelineAssertions `yaml:"assertions,omitempty"` WorkDir string `yaml:"working-directory,omitempty"` SBOM SBOM `yaml:"sbom,omitempty"` // contains filtered or unexported fields }
func NewPipeline ¶
func NewPipeline(ctx *PipelineContext) (*Pipeline, error)
func (*Pipeline) ApplyNeeds ¶
func (p *Pipeline) ApplyNeeds(ctx *PipelineContext) error
TODO(kaniini): Precompile pipeline before running / evaluating its needs.
type PipelineAssertions ¶ added in v0.2.0
type PipelineAssertions struct {
RequiredSteps int `yaml:"required-steps,omitempty"`
}
type PipelineContext ¶
type PipelineContext struct { Context *Context Package *Package Subpackage *Subpackage }
type RangeData ¶ added in v0.2.0
type RangeData struct { Name string `yaml:"name"` Items DataItemList `yaml:"items"` }
type ReleaseMonitor ¶ added in v0.3.0
type ReleaseMonitor struct {
Identifier int `yaml:"identifier"` // ID number for release monitor
}
ReleaseMonitor indicates using the API for https://release-monitoring.org/
type Scriptlets ¶ added in v0.2.0
type Scriptlets struct { Trigger struct { Script string Paths []string } `yaml:"trigger,omitempty"` PreInstall string `yaml:"pre-install,omitempty"` PostInstall string `yaml:"post-install,omitempty"` PreDeinstall string `yaml:"pre-deinstall,omitempty"` PostDeinstall string `yaml:"post-deinstall,omitempty"` PreUpgrade string `yaml:"pre-upgrade,omitempty"` PostUpgrade string `yaml:"post-upgrade,omitempty"` }
type Subpackage ¶
type Subpackage struct { If string `yaml:"if,omitempty"` Range string `yaml:"range,omitempty"` Name string `yaml:"name"` Pipeline []Pipeline `yaml:"pipeline,omitempty"` Dependencies Dependencies `yaml:"dependencies,omitempty"` Options PackageOption `yaml:"options,omitempty"` Scriptlets Scriptlets `yaml:"scriptlets,omitempty"` Description string `yaml:"description,omitempty"` URL string `yaml:"url,omitempty"` Commit string `yaml:"commit,omitempty"` }
func (*Subpackage) Emit ¶
func (spkg *Subpackage) Emit(ctx *PipelineContext) error
func (Subpackage) PackageURL ¶ added in v0.3.0
func (spkg Subpackage) PackageURL(distro, packageVersionWithRelease string) string
PackageURL returns the package URL ("purl") for the subpackage. For more information, see https://github.com/package-url/purl-spec#purl.
func (Subpackage) ShouldRun ¶ added in v0.3.0
func (sp Subpackage) ShouldRun(pctx *PipelineContext) (bool, error)
type Update ¶ added in v0.3.0
type Update struct { Enabled bool `yaml:"enabled"` // toggle if updates should occur VersionSeparator string `yaml:"version-separator,omitempty"` // override the version separator if it is nonstandard ReleaseMonitor *ReleaseMonitor `yaml:"release-monitor,omitempty"` GitHubMonitor *GitHubMonitor `yaml:"github,omitempty"` }
Update provides information used to describe how to keep the package up to date