Documentation ¶
Index ¶
- Constants
- Variables
- func AccessAttestationBundleInCachedArchive(fn string, handler func(bundle io.Reader) error) (err error)
- func Build(pkg *Package, opts ...BuildOption) (err error)
- func CopyWorkspace(dst string, workspace *Workspace, strict bool) error
- func DeleteNonWorkspaceFiles(dst string, workspace *Workspace, strict bool) (err error)
- func DiscoverWorkspaceRoot() (string, error)
- func FilesystemSafeName(fn string) string
- func FindUnresolvedArguments(pkg *Package) ([]string, error)
- func FormatBUILDyaml(out io.Writer, in io.Reader, fixIssues bool) error
- func TopologicalSort(pkgs []*Package)
- func WatchSources(ctx context.Context, pkgs []*Package, debounceDuration time.Duration) (changed <-chan struct{}, errs <-chan error)
- type Arguments
- type AttestationBundle
- type BuildOption
- func WithBuildPlan(out io.Writer) BuildOption
- func WithCoverageOutputPath(output string) BuildOption
- func WithDockerBuildOptions(dockerBuildOpts *DockerBuildOptions) BuildOption
- func WithDontTest(dontTest bool) BuildOption
- func WithDryRun(dryrun bool) BuildOption
- func WithJailedExecution(jailedExecution bool) BuildOption
- func WithLocalCache(cache Cache) BuildOption
- func WithMaxConcurrentTasks(n int64) BuildOption
- func WithRemoteCache(cache RemoteCache) BuildOption
- func WithReporter(reporter Reporter) BuildOption
- type Cache
- type CacheLevel
- type Component
- type CompositeReporter
- func (cr CompositeReporter) BuildFinished(pkg *Package, err error)
- func (cr CompositeReporter) BuildStarted(pkg *Package, status map[*Package]PackageBuildStatus)
- func (cr CompositeReporter) PackageBuildFinished(pkg *Package, rep *PackageBuildReport)
- func (cr CompositeReporter) PackageBuildLog(pkg *Package, isErr bool, buf []byte)
- func (cr CompositeReporter) PackageBuildStarted(pkg *Package)
- type ConsoleReporter
- func (r *ConsoleReporter) BuildFinished(pkg *Package, err error)
- func (r *ConsoleReporter) BuildStarted(pkg *Package, status map[*Package]PackageBuildStatus)
- func (r *ConsoleReporter) PackageBuildFinished(pkg *Package, rep *PackageBuildReport)
- func (r *ConsoleReporter) PackageBuildLog(pkg *Package, isErr bool, buf []byte)
- func (r *ConsoleReporter) PackageBuildStarted(pkg *Package)
- type DockerBuildOptions
- type DockerPkgConfig
- type EnvironmentManifest
- type EnvironmentManifestEntry
- type FilesystemCache
- type GSUtilRemoteCache
- type GenericPkgConfig
- type GitHubActionReporter
- type GitInfo
- type GoPackaging
- type GoPkgConfig
- type HTMLPackageReport
- func (r *HTMLPackageReport) DurationInSeconds() string
- func (r *HTMLPackageReport) Error() string
- func (r *HTMLPackageReport) HasError() bool
- func (r *HTMLPackageReport) HasLogs() bool
- func (r *HTMLPackageReport) HasResults() bool
- func (r *HTMLPackageReport) Logs() string
- func (r *HTMLPackageReport) Results() []string
- func (r *HTMLPackageReport) StatusIcon() string
- type HTMLReporter
- func (r *HTMLReporter) BuildFinished(pkg *Package, err error)
- func (r *HTMLReporter) BuildStarted(pkg *Package, status map[*Package]PackageBuildStatus)
- func (r *HTMLReporter) PackageBuildFinished(pkg *Package, rep *PackageBuildReport)
- func (r *HTMLReporter) PackageBuildLog(pkg *Package, isErr bool, buf []byte)
- func (r *HTMLReporter) PackageBuildStarted(pkg *Package)
- func (r *HTMLReporter) Report()
- type NoRemoteCache
- type NoopReporter
- func (*NoopReporter) BuildFinished(pkg *Package, err error)
- func (*NoopReporter) BuildStarted(pkg *Package, status map[*Package]PackageBuildStatus)
- func (*NoopReporter) PackageBuildFinished(pkg *Package, rep *PackageBuildReport)
- func (*NoopReporter) PackageBuildLog(pkg *Package, isErr bool, buf []byte)
- func (*NoopReporter) PackageBuildStarted(pkg *Package)
- type Package
- func (p *Package) BuildLayoutLocation(dependency *Package) (loc string)
- func (p *Package) ContentManifest() ([]string, error)
- func (p *Package) DefinitionHash() (string, error)
- func (p *Package) Dependants() []*Package
- func (p *Package) FilesystemSafeName() string
- func (p *Package) FullName() string
- func (p *Package) GetDependencies() []*Package
- func (p *Package) GetTransitiveDependencies() []*Package
- func (p *Package) TransitiveDependants() []*Package
- func (p *Package) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (p *Package) Version() (string, error)
- func (p *Package) WriteVersionManifest(out io.Writer) error
- type PackageBuildPhase
- type PackageBuildReport
- type PackageBuildStatus
- type PackageConfig
- type PackageInternal
- type PackageNotFoundErr
- type PackageType
- type PackageVariant
- func (v *PackageVariant) Config(t PackageType) (cfg PackageConfig, ok bool)
- func (v *PackageVariant) ExcludeComponent(name string) bool
- func (v *PackageVariant) ResolveSources(workspace *Workspace, loc string) (incl []string, excl []string, err error)
- func (v *PackageVariant) UnmarshalYAML(unmarshal func(interface{}) error) error
- type PkgNotBuiltErr
- type RemoteCache
- type Reporter
- type S3RemoteCache
- type Script
- type ScriptType
- type SegmentReporter
- type WerftReporter
- type WorkdirLayout
- type Workspace
- type WorkspaceProvenance
- type YarnPackaging
- type YarnPkgConfig
Constants ¶
const ( // EnvvarCacheDir names the environment variable we take the cache dir location from EnvvarCacheDir = "LEEWAY_CACHE_DIR" // EnvvarBuildDir names the environment variable we take the build dir location from EnvvarBuildDir = "LEEWAY_BUILD_DIR" // EnvvarYarnMutex configures the mutex flag leeway will pass to yarn. // See https://yarnpkg.com/lang/en/docs/cli/#toc-concurrency-and-mutex for possible values. // Defaults to "network". EnvvarYarnMutex = "LEEWAY_YARN_MUTEX" )
const ( // BuiltinArgPackageVersion is a builtin argument/variable which contains the version of the package currently building BuiltinArgPackageVersion = "__pkg_version" // BuildinArgGitCommit is a builtin argument/variable which contains the current Git commit if the build is executed from within a Git working copy. // If this variable is used and the build is not executed from within a Git working copy the variable resolution will fail. BuildinArgGitCommit = "__git_commit" // BuildinArgGitCommitShort is the shortened version of BuildinArgGitCommit to the first 7 characters BuildinArgGitCommitShort = "__git_commit_short" )
const (
// ProvenanceBuilderID is the prefix we use as Builder ID when issuing provenance
ProvenanceBuilderID = "github.com/gitpod-io/leeway"
)
const S3_PART_SIZE = 5 * 1024 * 1024
The part size of S3 bucket uploads/downloads for multipart file operations. See also: https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html
Variables ¶
var ErrNoAttestationBundle error = fmt.Errorf("no attestation bundle found")
var Version string = "unkown"
Version is the version of this leeway build
Functions ¶
func AccessAttestationBundleInCachedArchive ¶ added in v0.2.12
func AccessAttestationBundleInCachedArchive(fn string, handler func(bundle io.Reader) error) (err error)
AccessAttestationBundleInCachedArchive provides access to the attestation bundle in a cached build artifact. If no such bundle exists, ErrNoAttestationBundle is returned.
func Build ¶
func Build(pkg *Package, opts ...BuildOption) (err error)
Build builds the packages in the order they're given. It's the callers responsibility to ensure the dependencies are built in order.
func CopyWorkspace ¶
CopyWorkspace copies all folders/files from a workspace to a destination. If strict is true we'll only copy the files that leeway actully knows are source files. Otherwise we'll copy all files that are not excluded by the variant.
func DeleteNonWorkspaceFiles ¶
DeleteNonWorkspaceFiles removes all files that do not belong to a workspace. If strict is true this function deletes all files that are not listed as source in a package. If strict is fales this function deletes files excluded by a variant.
func DiscoverWorkspaceRoot ¶ added in v0.8.3
func FilesystemSafeName ¶ added in v0.8.3
func FindUnresolvedArguments ¶
FindUnresolvedArguments finds any still unresolved build arguments in a set of packages
func FormatBUILDyaml ¶
FormatBUILDyaml formats a component's build.yaml file
func TopologicalSort ¶
func TopologicalSort(pkgs []*Package)
TopologicalSort sorts the list of packages by its build order according to the dependency tree
Types ¶
type AttestationBundle ¶ added in v0.2.12
type AttestationBundle struct {
// contains filtered or unexported fields
}
AttestationBundle represents an in-toto attestation bundle. See https://github.com/in-toto/attestation/blob/main/spec/bundle.md for more details.
func (*AttestationBundle) Add ¶ added in v0.2.12
func (a *AttestationBundle) Add(env *provenance.Envelope) error
Add adds an entry to the bundle and writes it directly to the out writer. This function ensures an envelope is added only once. This function is not synchronised.
func (*AttestationBundle) AddFromBundle ¶ added in v0.2.12
func (a *AttestationBundle) AddFromBundle(other io.Reader) error
Adds the entries from another bundle to this one, writing them directly to the out writer. This function ensures entries are unique. This function is not synchronised.
func (*AttestationBundle) Len ¶ added in v0.2.12
func (a *AttestationBundle) Len() int
type BuildOption ¶
type BuildOption func(*buildOptions) error
BuildOption configures the build behaviour
func WithBuildPlan ¶
func WithBuildPlan(out io.Writer) BuildOption
WithBuildPlan writes the build plan as JSON to the writer
func WithCoverageOutputPath ¶
func WithCoverageOutputPath(output string) BuildOption
WithCoverageOutputPath configures coverage output directory
func WithDockerBuildOptions ¶ added in v0.2.7
func WithDockerBuildOptions(dockerBuildOpts *DockerBuildOptions) BuildOption
WithDockerBuildOptions are passed to "docker build"
func WithDontTest ¶
func WithDontTest(dontTest bool) BuildOption
WithDontTest disables package-level tests
func WithJailedExecution ¶ added in v0.2.18
func WithJailedExecution(jailedExecution bool) BuildOption
WithJailedExecution runs all commands in a runc jail
func WithLocalCache ¶
func WithLocalCache(cache Cache) BuildOption
WithLocalCache configures the local cache
func WithMaxConcurrentTasks ¶
func WithMaxConcurrentTasks(n int64) BuildOption
WithMaxConcurrentTasks limits the number of concurrent tasks during the build
func WithRemoteCache ¶
func WithRemoteCache(cache RemoteCache) BuildOption
WithRemoteCache configures the remote cache
func WithReporter ¶
func WithReporter(reporter Reporter) BuildOption
WithReporter sets the reporter which is notified about the build progress
type Cache ¶
type Cache interface { // Location returns the absolute filesystem path for a package build artifact Location(pkg *Package) (path string, exists bool) }
Cache provides filesystem locations for package build artifacts.
type CacheLevel ¶
type CacheLevel string
CacheLevel describes a level of package cache
const ( // CacheUnspecified allows all downloads/uploads/caching operations CacheUnspecified CacheLevel = "" // CacheNone means no caching happens at all CacheNone CacheLevel = "none" // CacheLocal means a package is only cached locally CacheLocal CacheLevel = "local" // CacheRemote means a package is downloaded from and uploaded to a remote cache CacheRemote CacheLevel = "remote" // CacheRemotePush means a package is cached locally and possibly uploaded to a remote cache, // but it will never be downloaded from a remote cache. CacheRemotePush CacheLevel = "remote-push" // CacheRemotePull means a package is cached locally and possibly downloaded from a remote cache, // but it will never be uploaded to a remote cache. CacheRemotePull CacheLevel = "remote-pull" )
func (CacheLevel) RemoteDownload ¶
func (c CacheLevel) RemoteDownload() bool
RemoteDownload returns true if this cache level permitts local download
func (CacheLevel) RemoteUpload ¶
func (c CacheLevel) RemoteUpload() bool
RemoteUpload retruns true if the cache level permitts remote upload
func (*CacheLevel) UnmarshalYAML ¶
func (c *CacheLevel) UnmarshalYAML(unmarshal func(interface{}) error) (err error)
UnmarshalYAML unmarshals and validates a package type
type Component ¶
type Component struct { // W is the workspace this component belongs to W *Workspace // Origin is the absolute location of this Component in the filepath Origin string // Name is the name of the Component as computed from its location in the workspace Name string Constants Arguments `yaml:"const"` Packages []*Package `yaml:"packages"` Scripts []*Script `yaml:"scripts"` // contains filtered or unexported fields }
Component contains a single component that we wish to build
type CompositeReporter ¶ added in v0.7.5
type CompositeReporter []Reporter
func (CompositeReporter) BuildFinished ¶ added in v0.7.5
func (cr CompositeReporter) BuildFinished(pkg *Package, err error)
BuildFinished implements Reporter
func (CompositeReporter) BuildStarted ¶ added in v0.7.5
func (cr CompositeReporter) BuildStarted(pkg *Package, status map[*Package]PackageBuildStatus)
BuildStarted implements Reporter
func (CompositeReporter) PackageBuildFinished ¶ added in v0.7.5
func (cr CompositeReporter) PackageBuildFinished(pkg *Package, rep *PackageBuildReport)
PackageBuildFinished implements Reporter
func (CompositeReporter) PackageBuildLog ¶ added in v0.7.5
func (cr CompositeReporter) PackageBuildLog(pkg *Package, isErr bool, buf []byte)
PackageBuildLog implements Reporter
func (CompositeReporter) PackageBuildStarted ¶ added in v0.7.5
func (cr CompositeReporter) PackageBuildStarted(pkg *Package)
PackageBuildStarted implements Reporter
type ConsoleReporter ¶
type ConsoleReporter struct {
// contains filtered or unexported fields
}
ConsoleReporter reports build progress by printing to stdout/stderr
func NewConsoleReporter ¶
func NewConsoleReporter() *ConsoleReporter
NewConsoleReporter produces a new console logger
func (*ConsoleReporter) BuildFinished ¶
func (r *ConsoleReporter) BuildFinished(pkg *Package, err error)
BuildFinished is called when the build of a package which was started by the user has finished.
func (*ConsoleReporter) BuildStarted ¶
func (r *ConsoleReporter) BuildStarted(pkg *Package, status map[*Package]PackageBuildStatus)
BuildStarted is called when the build of a package is started by the user.
func (*ConsoleReporter) PackageBuildFinished ¶
func (r *ConsoleReporter) PackageBuildFinished(pkg *Package, rep *PackageBuildReport)
PackageBuildFinished is called when the package build has finished.
func (*ConsoleReporter) PackageBuildLog ¶
func (r *ConsoleReporter) PackageBuildLog(pkg *Package, isErr bool, buf []byte)
PackageBuildLog is called during a package build whenever a build command produced some output.
func (*ConsoleReporter) PackageBuildStarted ¶
func (r *ConsoleReporter) PackageBuildStarted(pkg *Package)
PackageBuildStarted is called when a package build actually gets underway.
type DockerBuildOptions ¶ added in v0.2.7
DockerBuildOptions are options passed to "docker build"
type DockerPkgConfig ¶
type DockerPkgConfig struct { Dockerfile string `yaml:"dockerfile,omitempty"` Image []string `yaml:"image,omitempty"` BuildArgs map[string]string `yaml:"buildArgs,omitempty"` Squash bool `yaml:"squash,omitempty"` Metadata map[string]string `yaml:"metadata,omitempty"` }
DockerPkgConfig configures a Docker package
func (DockerPkgConfig) AdditionalSources ¶
func (cfg DockerPkgConfig) AdditionalSources(workspaceOrigin string) []string
AdditionalSources returns a list of unresolved sources coming in through this configuration
type EnvironmentManifest ¶
type EnvironmentManifest []EnvironmentManifestEntry
EnvironmentManifest is a collection of environment manifest entries
func (EnvironmentManifest) Hash ¶
func (mf EnvironmentManifest) Hash() (string, error)
Hash produces the hash of this manifest
func (EnvironmentManifest) MarshalJSON ¶ added in v0.2.12
func (mf EnvironmentManifest) MarshalJSON() ([]byte, error)
MarshalJSON marshals a built-up environment manifest into JSON
type EnvironmentManifestEntry ¶
type EnvironmentManifestEntry struct { Name string `yaml:"name"` Command []string `yaml:"command"` Value string `yaml:"-"` Builtin bool `yaml:"-"` }
EnvironmentManifestEntry represents an entry in the environment manifest
type FilesystemCache ¶
type FilesystemCache struct {
Origin string
}
FilesystemCache implements a flat folder cache
func NewFilesystemCache ¶
func NewFilesystemCache(location string) (*FilesystemCache, error)
NewFilesystemCache creates a new filesystem cache
type GSUtilRemoteCache ¶
type GSUtilRemoteCache struct {
BucketName string
}
GSUtilRemoteCache uses the gsutil command to implement a remote cache
func (GSUtilRemoteCache) Download ¶
func (rs GSUtilRemoteCache) Download(dst Cache, pkgs []*Package) error
Download makes a best-effort attempt at downloading previously cached build artifacts
func (GSUtilRemoteCache) ExistingPackages ¶ added in v0.5.0
func (rs GSUtilRemoteCache) ExistingPackages(pkgs []*Package) (map[*Package]struct{}, error)
ExistingPackages returns existing cached build artifacts in the remote cache
type GenericPkgConfig ¶
type GenericPkgConfig struct { Commands [][]string `yaml:"commands"` Test [][]string `yaml:"test,omitempty"` DontTest bool `yaml:"dontTest,omitempty"` }
GenericPkgConfig configures a generic package
func (GenericPkgConfig) AdditionalSources ¶
func (cfg GenericPkgConfig) AdditionalSources(workspaceOrigin string) []string
AdditionalSources returns a list of unresolved sources coming in through this configuration
type GitHubActionReporter ¶ added in v0.8.3
type GitHubActionReporter struct { NoopReporter // contains filtered or unexported fields }
func NewGitHubReporter ¶ added in v0.8.3
func NewGitHubReporter() *GitHubActionReporter
func (*GitHubActionReporter) PackageBuildFinished ¶ added in v0.8.3
func (sr *GitHubActionReporter) PackageBuildFinished(pkg *Package, rep *PackageBuildReport)
type GitInfo ¶ added in v0.2.10
type GitInfo struct { WorkingCopyLoc string Commit string Origin string // contains filtered or unexported fields }
func GetGitInfo ¶ added in v0.2.12
GetGitInfo returns the git status required during a leeway build
func (*GitInfo) DirtyFiles ¶ added in v0.2.17
DirtyFiles returns true if a single file of the file list is dirty.
type GoPackaging ¶
type GoPackaging string
GoPackaging configures the packaging method of a Go package
const ( // GoLibrary means the package can be imported in another package GoLibrary GoPackaging = "library" // GoApp runs go build and tars the build directory GoApp GoPackaging = "app" )
type GoPkgConfig ¶
type GoPkgConfig struct { Packaging GoPackaging `yaml:"packaging,omitempty"` Generate bool `yaml:"generate,omitempty"` DontTest bool `yaml:"dontTest,omitempty"` DontCheckGoFmt bool `yaml:"dontCheckGoFmt,omitempty"` DontLint bool `yaml:"dontLint,omitempty"` BuildFlags []string `yaml:"buildFlags,omitempty"` BuildCommand []string `yaml:"buildCommand,omitempty"` LintCommand []string `yaml:"lintCommand,omitempty"` GoVersion string `yaml:"goVersion,omitempty"` GoMod string `yaml:"goMod,omitempty"` }
GoPkgConfig configures a Go package
func (GoPkgConfig) AdditionalSources ¶
func (cfg GoPkgConfig) AdditionalSources(workspaceOrigin string) []string
AdditionalSources returns a list of unresolved sources coming in through this configuration
func (GoPkgConfig) Validate ¶
func (cfg GoPkgConfig) Validate() error
Validate ensures this config can be acted upon/is valid
type HTMLPackageReport ¶ added in v0.7.5
type HTMLPackageReport struct {
// contains filtered or unexported fields
}
func (*HTMLPackageReport) DurationInSeconds ¶ added in v0.7.5
func (r *HTMLPackageReport) DurationInSeconds() string
func (*HTMLPackageReport) Error ¶ added in v0.7.5
func (r *HTMLPackageReport) Error() string
func (*HTMLPackageReport) HasError ¶ added in v0.7.5
func (r *HTMLPackageReport) HasError() bool
func (*HTMLPackageReport) HasLogs ¶ added in v0.7.5
func (r *HTMLPackageReport) HasLogs() bool
func (*HTMLPackageReport) HasResults ¶ added in v0.7.5
func (r *HTMLPackageReport) HasResults() bool
func (*HTMLPackageReport) Logs ¶ added in v0.7.5
func (r *HTMLPackageReport) Logs() string
func (*HTMLPackageReport) Results ¶ added in v0.7.5
func (r *HTMLPackageReport) Results() []string
func (*HTMLPackageReport) StatusIcon ¶ added in v0.7.5
func (r *HTMLPackageReport) StatusIcon() string
type HTMLReporter ¶ added in v0.4.0
type HTMLReporter struct {
// contains filtered or unexported fields
}
func NewHTMLReporter ¶ added in v0.4.0
func NewHTMLReporter(filename string) *HTMLReporter
func (*HTMLReporter) BuildFinished ¶ added in v0.4.0
func (r *HTMLReporter) BuildFinished(pkg *Package, err error)
func (*HTMLReporter) BuildStarted ¶ added in v0.4.0
func (r *HTMLReporter) BuildStarted(pkg *Package, status map[*Package]PackageBuildStatus)
func (*HTMLReporter) PackageBuildFinished ¶ added in v0.4.0
func (r *HTMLReporter) PackageBuildFinished(pkg *Package, rep *PackageBuildReport)
func (*HTMLReporter) PackageBuildLog ¶ added in v0.4.0
func (r *HTMLReporter) PackageBuildLog(pkg *Package, isErr bool, buf []byte)
func (*HTMLReporter) PackageBuildStarted ¶ added in v0.4.0
func (r *HTMLReporter) PackageBuildStarted(pkg *Package)
func (*HTMLReporter) Report ¶ added in v0.4.0
func (r *HTMLReporter) Report()
type NoRemoteCache ¶
type NoRemoteCache struct{}
NoRemoteCache implements the default no-remote cache behavior
func (NoRemoteCache) Download ¶
func (NoRemoteCache) Download(dst Cache, pkgs []*Package) error
Download makes a best-effort attempt at downloading previously cached build artifacts
func (NoRemoteCache) ExistingPackages ¶ added in v0.5.0
func (NoRemoteCache) ExistingPackages(pkgs []*Package) (map[*Package]struct{}, error)
ExistingPackages returns existing cached build artifacts in the remote cache
type NoopReporter ¶ added in v0.7.5
type NoopReporter struct{}
func (*NoopReporter) BuildFinished ¶ added in v0.7.5
func (*NoopReporter) BuildFinished(pkg *Package, err error)
BuildFinished implements Reporter
func (*NoopReporter) BuildStarted ¶ added in v0.7.5
func (*NoopReporter) BuildStarted(pkg *Package, status map[*Package]PackageBuildStatus)
BuildStarted implements Reporter
func (*NoopReporter) PackageBuildFinished ¶ added in v0.7.5
func (*NoopReporter) PackageBuildFinished(pkg *Package, rep *PackageBuildReport)
PackageBuildFinished implements Reporter
func (*NoopReporter) PackageBuildLog ¶ added in v0.7.5
func (*NoopReporter) PackageBuildLog(pkg *Package, isErr bool, buf []byte)
PackageBuildLog implements Reporter
func (*NoopReporter) PackageBuildStarted ¶ added in v0.7.5
func (*NoopReporter) PackageBuildStarted(pkg *Package)
PackageBuildStarted implements Reporter
type Package ¶
type Package struct { C *Component `yaml:"-"` PackageInternal `yaml:"_,inline"` Config PackageConfig `yaml:"config,omitempty"` // Definition is the raw package definition YAML Definition []byte `yaml:"-"` // contains filtered or unexported fields }
Package is a single buildable artifact within a component
func (*Package) BuildLayoutLocation ¶
BuildLayoutLocation returns the filesystem path a dependency is expected at during the build. This path will always be relative. If the provided package is not a depedency of this package, we'll still return a valid path.
func (*Package) ContentManifest ¶
ContentManifest produces an ordered list of content hashes (<filename>:<hash>) for each source file. Expects the sources to be resolved.
func (*Package) DefinitionHash ¶
DefinitionHash hashes the package definition
func (*Package) Dependants ¶ added in v0.2.19
Dependants() returns a list of packages directly dependant on this package
func (*Package) FilesystemSafeName ¶
FilesystemSafeName returns a string that is safe to use in a Unix filesystem as directory or filename
func (*Package) GetDependencies ¶
GetDependencies returns the linked package dependencies or nil if not linked yet
func (*Package) GetTransitiveDependencies ¶
GetTransitiveDependencies returns all transitive dependencies of a package.
func (*Package) TransitiveDependants ¶ added in v0.2.19
Dependants() returns a list of packages directly dependant on this package
func (*Package) UnmarshalYAML ¶
UnmarshalYAML unmarshals the package definition
type PackageBuildPhase ¶ added in v0.7.5
type PackageBuildPhase string
const ( PackageBuildPhasePrep PackageBuildPhase = "prep" PackageBuildPhasePull PackageBuildPhase = "pull" PackageBuildPhaseLint PackageBuildPhase = "lint" PackageBuildPhaseTest PackageBuildPhase = "test" PackageBuildPhaseBuild PackageBuildPhase = "build" PackageBuildPhasePackage PackageBuildPhase = "package" )
type PackageBuildReport ¶ added in v0.7.5
type PackageBuildReport struct { Phases []PackageBuildPhase Error error TestCoverageAvailable bool TestCoveragePercentage int FunctionsWithoutTest int FunctionsWithTest int // contains filtered or unexported fields }
func (*PackageBuildReport) LastPhase ¶ added in v0.7.5
func (rep *PackageBuildReport) LastPhase() PackageBuildPhase
LastPhase returns the phase the package build last entered
func (*PackageBuildReport) PhaseDuration ¶ added in v0.7.5
func (rep *PackageBuildReport) PhaseDuration(phase PackageBuildPhase) (dt time.Duration)
PhaseDuration returns the time it took to execute the phases commands
func (*PackageBuildReport) TotalTime ¶ added in v0.7.5
func (rep *PackageBuildReport) TotalTime() time.Duration
TotalTime is the total time spent on building this package
type PackageBuildStatus ¶
type PackageBuildStatus string
PackageBuildStatus denotes the status of a package during build
const ( // PackageNotBuiltYet means that the package has not been built yet PackageNotBuiltYet PackageBuildStatus = "not-built-yet" // PackageBuilding means we're building this package at the moment PackageBuilding PackageBuildStatus = "building" // PackageBuilt means the package has been built and exists in the local cache already PackageBuilt PackageBuildStatus = "built-locally" // PackageDownloaded means the package was downloaded from the remote cache as part of this build PackageDownloaded PackageBuildStatus = "downloaded" // PackageInRemoteCache means the package has been built but currently only exists in the remote cache PackageInRemoteCache PackageBuildStatus = "built-remotely" )
type PackageConfig ¶
PackageConfig is the YAML unmarshalling config type of packages. This is one of YarnPkgConfig, GoPkgConfig, DockerPkgConfig or GenericPkgConfig.
type PackageInternal ¶ added in v0.6.0
type PackageInternal struct { Name string `yaml:"name"` Type PackageType `yaml:"type"` Sources []string `yaml:"srcs,omitempty"` Dependencies []string `yaml:"deps,omitempty"` Layout map[string]string `yaml:"layout,omitempty"` ArgumentDependencies []string `yaml:"argdeps,omitempty"` Environment []string `yaml:"env,omitempty"` Ephemeral bool `yaml:"ephemeral,omitempty"` PreparationCommands [][]string `yaml:"prep,omitempty"` }
PackageInternal is the YAML serialised content of a package
type PackageNotFoundErr ¶
type PackageNotFoundErr struct {
Package string
}
PackageNotFoundErr is used when something references a package we don't know about
func (PackageNotFoundErr) Error ¶
func (n PackageNotFoundErr) Error() string
type PackageType ¶
type PackageType string
PackageType describes the way a package is built and what it produces
const ( // YarnPackage uses the yarn package manager to download dependencies and build the package YarnPackage PackageType = "yarn" // GoPackage runs go build and produces a binary file GoPackage PackageType = "go" // DockerPackage runs docker build DockerPackage PackageType = "docker" // GenericPackage runs an arbitary shell command GenericPackage PackageType = "generic" )
func (*PackageType) UnmarshalYAML ¶
func (p *PackageType) UnmarshalYAML(unmarshal func(interface{}) error) (err error)
UnmarshalYAML unmarshals and validates a package type
type PackageVariant ¶
type PackageVariant struct {
// contains filtered or unexported fields
}
PackageVariant provides a variation point for a package's sources, environment variables and config.
func (*PackageVariant) Config ¶
func (v *PackageVariant) Config(t PackageType) (cfg PackageConfig, ok bool)
Config returns this package variants configuration
func (*PackageVariant) ExcludeComponent ¶
func (v *PackageVariant) ExcludeComponent(name string) bool
ExcludeComponent returns true if this variants excludes the component
func (*PackageVariant) ResolveSources ¶
func (v *PackageVariant) ResolveSources(workspace *Workspace, loc string) (incl []string, excl []string, err error)
ResolveSources lists all files which are explicitely included or excluded by this variant. Inclusion takes precedence over exclusion.
func (*PackageVariant) UnmarshalYAML ¶
func (v *PackageVariant) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML unmarshals a package variant
type PkgNotBuiltErr ¶
type PkgNotBuiltErr struct {
Package *Package
}
PkgNotBuiltErr is used when a package's dependency hasn't been built yet
func (PkgNotBuiltErr) Error ¶
func (p PkgNotBuiltErr) Error() string
type RemoteCache ¶
type RemoteCache interface { // ExistingPackages returns existing cached build artifacts in the remote cache ExistingPackages(pkgs []*Package) (map[*Package]struct{}, error) // Download makes a best-effort attempt at downloading previously cached build artifacts for the given packages // in their current version. A cache miss (i.e. a build artifact not being available) does not constitute an // error. Get should try and download as many artifacts as possible. Download(dst Cache, pkgs []*Package) error // Upload makes a best effort to upload the build arfitacts to a remote cache. If uploading an artifact fails, that // does not constitute an error. Upload(src Cache, pkgs []*Package) error }
RemoteCache can download and upload build artifacts into a local cache
type Reporter ¶
type Reporter interface { // BuildStarted is called when the build of a package is started by the user. // This is not the same as a dependency beeing built (see PackageBuildStarted for that). // The root package will also be passed into PackageBuildStarted once all its depepdencies // have been built. BuildStarted(pkg *Package, status map[*Package]PackageBuildStatus) // BuildFinished is called when the build of a package which was started by the user has finished. // This is not the same as a dependency build finished (see PackageBuildFinished for that). // The root package will also be passed into PackageBuildFinished once it's been built. BuildFinished(pkg *Package, err error) // PackageBuildStarted is called when a package build actually gets underway. At this point // all transitive dependencies of the package have been built. PackageBuildStarted(pkg *Package) // PackageBuildLog is called during a package build whenever a build command produced some output. PackageBuildLog(pkg *Package, isErr bool, buf []byte) // PackageBuildFinished is called when the package build has finished. If an error is passed in // the package build was not succesfull. PackageBuildFinished(pkg *Package, rep *PackageBuildReport) }
Reporter provides feedback about the build progress to the user.
Implementers beware: all these functions will be called in the hotpath of the build system. That means that blocking in those functions will block the actual build.
type S3RemoteCache ¶ added in v0.7.4
type S3RemoteCache struct { BucketName string // contains filtered or unexported fields }
S3RemoteCache uses the AWS Go SDK to implement a remote cache.
func NewS3RemoteCache ¶ added in v0.7.4
func NewS3RemoteCache(bucketName string, cfg *aws.Config) (*S3RemoteCache, error)
func (*S3RemoteCache) Download ¶ added in v0.7.4
func (rs *S3RemoteCache) Download(dst Cache, pkgs []*Package) error
Download makes a best-effort attempt at downloading previously cached build artifacts for the given packages in their current version. A cache miss (i.e. a build artifact not being available) does not constitute an error. Get should try and download as many artifacts as possible.
func (*S3RemoteCache) ExistingPackages ¶ added in v0.7.4
func (rs *S3RemoteCache) ExistingPackages(pkgs []*Package) (map[*Package]struct{}, error)
ExistingPackages returns existing cached build artifacts in the remote cache
type Script ¶
type Script struct { C *Component Name string `yaml:"name"` Description string `yaml:"description"` Dependencies []string `yaml:"deps"` Environment []string `yaml:"env"` WorkdirLayout WorkdirLayout `yaml:"workdir"` Type ScriptType `yaml:"type"` Script string `yaml:"script"` // contains filtered or unexported fields }
Script is an executable, uncacheable unit that does not result in build artefacts
func (*Script) FilesystemSafeName ¶
FilesystemSafeName returns a string that is safe to use in a Unix filesystem as directory or filename
func (*Script) GetDependencies ¶
GetDependencies returns the linked package dependencies or nil if not linked yet
type ScriptType ¶
type ScriptType string
ScriptType defines the type a script is of
const ( // BashScript means the script is executed by bash. // The shebang is added automatically. BashScript ScriptType = "bash" )
type SegmentReporter ¶ added in v0.7.5
type SegmentReporter struct { NoopReporter AnonymousId string // contains filtered or unexported fields }
func NewSegmentReporter ¶ added in v0.7.5
func NewSegmentReporter(key string) *SegmentReporter
func (*SegmentReporter) BuildFinished ¶ added in v0.7.5
func (sr *SegmentReporter) BuildFinished(pkg *Package, err error)
func (*SegmentReporter) BuildStarted ¶ added in v0.7.5
func (sr *SegmentReporter) BuildStarted(pkg *Package, status map[*Package]PackageBuildStatus)
BuildStarted implements Reporter
func (*SegmentReporter) PackageBuildFinished ¶ added in v0.7.5
func (sr *SegmentReporter) PackageBuildFinished(pkg *Package, rep *PackageBuildReport)
type WerftReporter ¶
type WerftReporter struct {
NoopReporter
}
WerftReporter works like the console reporter but adds werft output
func NewWerftReporter ¶
func NewWerftReporter() *WerftReporter
NewWerftReporter craetes a new werft compatible reporter
func (*WerftReporter) BuildStarted ¶
func (r *WerftReporter) BuildStarted(pkg *Package, status map[*Package]PackageBuildStatus)
BuildStarted is called when the build of a package is started by the user.
func (*WerftReporter) PackageBuildFinished ¶
func (r *WerftReporter) PackageBuildFinished(pkg *Package, rep *PackageBuildReport)
PackageBuildFinished is called when the package build has finished.
type WorkdirLayout ¶
type WorkdirLayout string
WorkdirLayout describes the layout of the working dir a script gets executed in
const ( // WorkdirOrigin means the script is executed in the original location of the component where it's defined, // in the original workspace. WorkdirOrigin WorkdirLayout = "origin" // WorkdirPackages replicates the structure leeway produces during a package build based on the script's dependencies. WorkdirPackages WorkdirLayout = "packages" )
type Workspace ¶
type Workspace struct { DefaultTarget string `yaml:"defaultTarget,omitempty"` ArgumentDefaults map[string]string `yaml:"defaultArgs,omitempty"` DefaultVariant *PackageVariant `yaml:"defaultVariant,omitempty"` Variants []*PackageVariant `yaml:"variants,omitempty"` EnvironmentManifest EnvironmentManifest `yaml:"environmentManifest,omitempty"` Provenance WorkspaceProvenance `yaml:"provenance,omitempty"` Origin string `yaml:"-"` Components map[string]*Component `yaml:"-"` Packages map[string]*Package `yaml:"-"` Scripts map[string]*Script `yaml:"-"` SelectedVariant *PackageVariant `yaml:"-"` Git GitInfo `yaml:"-"` // contains filtered or unexported fields }
Workspace is the root container of all compoments. All components are named relative to the origin of this workspace.
func FindWorkspace ¶
FindWorkspace looks for a WORKSPACE.yaml file within the path. If multiple such files are found, an error is returned.
func (*Workspace) ShouldIgnoreComponent ¶
ShouldIgnoreComponent returns true if a file should be ignored for a component listing
func (*Workspace) ShouldIgnoreSource ¶
ShouldIgnoreSource returns true if a file should be ignored for a source listing
type WorkspaceProvenance ¶ added in v0.2.10
type YarnPackaging ¶
type YarnPackaging string
YarnPackaging configures the packaging method of a yarn package
const ( // YarnLibrary means the package will be created using `yarn pack` YarnLibrary YarnPackaging = "library" // YarnOfflineMirror means that the package will become a yarn offline mirror YarnOfflineMirror YarnPackaging = "offline-mirror" // YarnApp installs the package using an empty package.json and tars the resulting node_modules/ YarnApp YarnPackaging = "app" // YarnArchive simply tars the build directory YarnArchive YarnPackaging = "archive" )
type YarnPkgConfig ¶
type YarnPkgConfig struct { YarnLock string `yaml:"yarnLock,omitempty"` TSConfig string `yaml:"tsconfig"` Packaging YarnPackaging `yaml:"packaging,omitempty"` DontTest bool `yaml:"dontTest,omitempty"` Commands struct { Install []string `yaml:"install,omitempty"` Build []string `yaml:"build,omitempty"` Test []string `yaml:"test,omitempty"` } `yaml:"commands,omitempty"` }
YarnPkgConfig configures a yarn package
func (YarnPkgConfig) AdditionalSources ¶
func (cfg YarnPkgConfig) AdditionalSources(workspaceOrigin string) []string
AdditionalSources returns a list of unresolved sources coming in through this configuration
func (YarnPkgConfig) Validate ¶
func (cfg YarnPkgConfig) Validate() error
Validate ensures this config can be acted upon/is valid