engine

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: MIT Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EnvvarCacheDir names the environment variable we take the cache dir location from
	EnvvarCacheDir = "GORPA_CACHE_DIR"

	// EnvvarBuildDir names the environment variable we take the build dir location from
	EnvvarBuildDir = "GORPA_BUILD_DIR"

	// EnvvarYarnMutex configures the mutex flag Bhojpur GoRPA will pass to yarn.
	// See https://yarnpkg.com/lang/en/docs/cli/#toc-concurrency-and-mutex for possible values.
	// Defaults to "network".
	EnvvarYarnMutex = "GORPA_YARN_MUTEX"
)
View Source
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"
)
View Source
const (

	// ProvenanceBuilderID is the prefix we use as Builder ID when issuing provenance
	ProvenanceBuilderID = "github.com/bhojpur/gorpa"
)

Variables

View Source
var ErrNoAttestationBundle error = fmt.Errorf("no attestation bundle found")

Functions

func AccessAttestationBundleInCachedArchive

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 CopyApplication

func CopyApplication(dst string, application *Application, strict bool) error

CopyApplication copies all folders/files from an application 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 DeleteNonApplicationFiles

func DeleteNonApplicationFiles(dst string, application *Application, strict bool) (err error)

DeleteNonApplicationFiles removes all files that do not belong to an application. 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 FindUnresolvedArguments

func FindUnresolvedArguments(pkg *Package) ([]string, error)

FindUnresolvedArguments finds any still unresolved build arguments in a set of packages

func FormatBUILDyaml

func FormatBUILDyaml(out io.Writer, in io.Reader, fixIssues bool) error

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

func WatchSources

func WatchSources(ctx context.Context, pkgs []*Package) (changed <-chan string, errs <-chan error)

WatchSources watches the source files of the packages until the context is done

Types

type Application

type Application 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          ApplicationProvenance `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
}

Application is the root container of all compoments. All components are named relative to the origin of this application.

func FindApplication

func FindApplication(path string, args Arguments, variant, provenanceKey string) (Application, error)

FindApplication looks for a APPLICATION.yaml file within the path. If multiple such files are found, an error is returned.

func FindNestedApplications

func FindNestedApplications(path string, args Arguments, variant string) (res Application, err error)

FindNestedApplications loads nested applications

func (*Application) ShouldIgnoreComponent

func (ba *Application) ShouldIgnoreComponent(path string) bool

ShouldIgnoreComponent returns true if a file should be ignored for a component listing

func (*Application) ShouldIgnoreSource

func (ba *Application) ShouldIgnoreSource(path string) bool

ShouldIgnoreSource returns true if a file should be ignored for a source listing

type ApplicationProvenance

type ApplicationProvenance struct {
	Enabled bool `yaml:"enabled"`
	SLSA    bool `yaml:"slsa"`

	KeyPath string `yaml:"key"`
	// contains filtered or unexported fields
}

type Arguments

type Arguments map[string]string

Arguments can be passed to components/packages introducing variation points

type AttestationBundle

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

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

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

func (a *AttestationBundle) Len() int

type BuildOption

type BuildOption func(*buildOptions) error

BuildOption configures the build behaviour

func WithAdditionalRemoteCaches

func WithAdditionalRemoteCaches(caches []RemoteCache) BuildOption

WithAdditionalRemoteCaches configures the remote cache

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

func WithDockerBuildOptions(dockerBuildOpts *DockerBuildOptions) BuildOption

WithDockerBuildOptions are passed to "docker build"

func WithDontRetag

func WithDontRetag(dontRetag bool) BuildOption

WithDontRetag disables the Docker image retagging

func WithDontTest

func WithDontTest(dontTest bool) BuildOption

WithDontTest disables package-level tests

func WithDryRun

func WithDryRun(dryrun bool) BuildOption

WithDryRun marks this build as dry run

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 application this component belongs to
	W *Application
	// 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 application
	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

func (*Component) Git

func (c *Component) Git() *GitInfo

GitCommit returns the git commit of this component or the application. Returns an empty string if neither the component, nor the application are part of a working copy.

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 whcih 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, err error)

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

type DockerBuildOptions map[string]string

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() []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

func (mf EnvironmentManifest) MarshalJSON() ([]byte, error)

MarshalJSON marshals a built-up environment manifest into JSON

func (EnvironmentManifest) Write

func (mf EnvironmentManifest) Write(out io.Writer) error

Write writes the manifest to the writer

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

func (*FilesystemCache) Location

func (fsc *FilesystemCache) Location(pkg *Package) (path string, exists bool)

Location computes the name of a packages build result artifact. Returns ok == true if that build artifact actually exists.

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) Upload

func (rs GSUtilRemoteCache) Upload(src Cache, pkgs []*Package) error

Upload makes a best effort to upload the build arfitacts to a 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() []string

AdditionalSources returns a list of unresolved sources coming in through this configuration

type GitInfo

type GitInfo struct {
	Commit string
	Origin string
	Dirty  bool
}

func GetGitInfo

func GetGitInfo(loc string) (*GitInfo, error)

GetGitInfo returns the git status required during a Bhojpur GoRPA build

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"`
	GoKart         struct {
		Enabled        bool   `yaml:"enabled,omitempty"`
		APIDepsPattern string `yaml:"apiDepsPattern,omitempty"`
	} `yaml:"gokart,omitempty"`
	BuildFlags   []string `yaml:"buildFlags,omitempty"`
	BuildCommand []string `yaml:"buildCommand,omitempty"`
	LintCommand  []string `yaml:"lintCommand,omitempty"`
	GoVersion    string   `yaml:"goVersion,omitempty"`
}

GoPkgConfig configures a Go package

func (GoPkgConfig) AdditionalSources

func (cfg GoPkgConfig) AdditionalSources() []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 GorpaReporter

type GorpaReporter struct {
	*ConsoleReporter
}

GorpaReporter works like the console reporter but adds GoRPA output

func NewGorpaReporter

func NewGorpaReporter() *GorpaReporter

NewGorpaReporter craetes a new GoRPA compatible reporter

func (*GorpaReporter) BuildStarted

func (r *GorpaReporter) BuildStarted(pkg *Package, status map[*Package]PackageBuildStatus)

BuildStarted is called when the build of a package is started by the user.

func (*GorpaReporter) PackageBuildFinished

func (r *GorpaReporter) PackageBuildFinished(pkg *Package, err error)

PackageBuildFinished is called when the package build has finished.

type MinioRemoteCache

type MinioRemoteCache struct {
	BucketName string
}

MinioRemoteCache uses the mc command to implement a remote cache

func (MinioRemoteCache) Download

func (rs MinioRemoteCache) Download(dst Cache, pkgs []*Package) error

Download makes a best-effort attempt at downloading previously cached build artifacts

func (MinioRemoteCache) Upload

func (rs MinioRemoteCache) Upload(src Cache, pkgs []*Package) error

Upload makes a best effort to upload the build arfitacts to a remote cache

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) Upload

func (NoRemoteCache) Upload(src Cache, pkgs []*Package) error

Upload makes a best effort to upload the build arfitacts to a remote cache

type Package

type Package struct {
	C *Component

	Config PackageConfig `yaml:"config"`
	// 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

func (p *Package) BuildLayoutLocation(dependency *Package) (loc string)

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

func (p *Package) ContentManifest() ([]string, error)

ContentManifest produces an ordered list of content hashes (<filename>:<hash>) for each source file. Expects the sources to be resolved.

func (*Package) DefinitionHash

func (p *Package) DefinitionHash() (string, error)

DefinitionHash hashes the package definition

func (*Package) FilesystemSafeName

func (p *Package) FilesystemSafeName() string

FilesystemSafeName returns a string that is safe to use in a Unix filesystem as directory or filename

func (*Package) FullName

func (p *Package) FullName() string

FullName returns the packages fully qualified name (component:package)

func (*Package) GetDependencies

func (p *Package) GetDependencies() []*Package

GetDependencies returns the linked package dependencies or nil if not linked yet

func (*Package) GetTransitiveDependencies

func (p *Package) GetTransitiveDependencies() []*Package

GetTransitiveDependencies returns all transitive dependencies of a package.

func (*Package) UnmarshalYAML

func (p *Package) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals the package definition

func (*Package) Version

func (p *Package) Version() (string, error)

Version computes the Package version based on the content hash of the sources

func (*Package) WriteVersionManifest

func (p *Package) WriteVersionManifest(out io.Writer) error

WriteVersionManifest writes the manifest whoose hash is the version of this package (see Version())

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 already
	PackageBuilt PackageBuildStatus = "built"
)

type PackageConfig

type PackageConfig interface {
	AdditionalSources() []string
}

PackageConfig is the YAML unmarshalling config type of packages. This is one of YarnPkgConfig, GoPkgConfig, DockerPkgConfig or GenericPkgConfig.

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 (
	// DeprecatedTypescriptPackage runs tsc in a package and produces a yarn offline mirror
	DeprecatedTypescriptPackage PackageType = "typescript"

	// 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(application *Application, 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 {
	// 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 whcih 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, err error)
}

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 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

func (p *Script) FilesystemSafeName() string

FilesystemSafeName returns a string that is safe to use in a Unix filesystem as directory or filename

func (*Script) FullName

func (p *Script) FullName() string

FullName returns the packages fully qualified name (component:package)

func (*Script) GetDependencies

func (p *Script) GetDependencies() []*Package

GetDependencies returns the linked package dependencies or nil if not linked yet

func (*Script) Run

func (p *Script) Run(opts ...BuildOption) error

Run executes the script

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 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 application.
	WorkdirOrigin WorkdirLayout = "origin"

	// WorkdirPackages replicates the structure Bhojpur GoRPA produces during a package build based on the script's dependencies.
	WorkdirPackages WorkdirLayout = "packages"
)

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() []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

Jump to

Keyboard shortcuts

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