generate

package
v0.0.0-...-41454cb Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APT_CACHE_KEY  = "apt"
	MISE_CACHE_KEY = "mise"
)
View Source
const (
	BinDir = "/railpack"
)
View Source
const (
	MisePackageStepName = "packages:mise"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AptStepBuilder

type AptStepBuilder struct {
	DisplayName string
	Packages    []string
	Inputs      []plan.Input
}

func (*AptStepBuilder) AddAptPackage

func (b *AptStepBuilder) AddAptPackage(pkg string)

func (*AptStepBuilder) AddInput

func (b *AptStepBuilder) AddInput(input plan.Input)

func (*AptStepBuilder) Build

func (b *AptStepBuilder) Build(options *BuildStepOptions) (*plan.Step, error)

func (*AptStepBuilder) Name

func (b *AptStepBuilder) Name() string

type BuildStepOptions

type BuildStepOptions struct {
	ResolvedPackages map[string]*resolver.ResolvedPackage
	Caches           *CacheContext
}

func (*BuildStepOptions) NewAptInstallCommand

func (o *BuildStepOptions) NewAptInstallCommand(pkgs []string) plan.Command

type CacheContext

type CacheContext struct {
	Caches map[string]*plan.Cache
}

func NewCacheContext

func NewCacheContext() *CacheContext

func (*CacheContext) AddCache

func (c *CacheContext) AddCache(name string, directory string) string

func (*CacheContext) AddCacheWithType

func (c *CacheContext) AddCacheWithType(name string, directory string, cacheType string) string

func (*CacheContext) GetAptCaches

func (c *CacheContext) GetAptCaches() []string

func (*CacheContext) GetCache

func (c *CacheContext) GetCache(name string) *plan.Cache

func (*CacheContext) SetCache

func (c *CacheContext) SetCache(name string, cache *plan.Cache)

type Command

type Command interface {
	IsSpread() bool
}

type CommandStepBuilder

type CommandStepBuilder struct {
	DisplayName string
	Commands    []plan.Command
	Inputs      []plan.Input
	Assets      map[string]string
	Variables   map[string]string
	Caches      []string
	Secrets     []string
	// contains filtered or unexported fields
}

func (*CommandStepBuilder) AddCache

func (b *CommandStepBuilder) AddCache(name string)

func (*CommandStepBuilder) AddCommand

func (b *CommandStepBuilder) AddCommand(command plan.Command)

func (*CommandStepBuilder) AddCommands

func (b *CommandStepBuilder) AddCommands(commands []plan.Command)

func (*CommandStepBuilder) AddEnvVars

func (b *CommandStepBuilder) AddEnvVars(envVars map[string]string)

func (*CommandStepBuilder) AddInput

func (b *CommandStepBuilder) AddInput(input plan.Input)

func (*CommandStepBuilder) AddInputs

func (b *CommandStepBuilder) AddInputs(inputs []plan.Input)

func (*CommandStepBuilder) AddPaths

func (b *CommandStepBuilder) AddPaths(paths []string)

func (*CommandStepBuilder) AddVariables

func (b *CommandStepBuilder) AddVariables(variables map[string]string)

func (*CommandStepBuilder) Build

func (b *CommandStepBuilder) Build(options *BuildStepOptions) (*plan.Step, error)

func (*CommandStepBuilder) Name

func (b *CommandStepBuilder) Name() string

func (*CommandStepBuilder) UseSecrets

func (b *CommandStepBuilder) UseSecrets(secrets []string)

func (*CommandStepBuilder) UseSecretsWithPrefix

func (b *CommandStepBuilder) UseSecretsWithPrefix(prefix string)

func (*CommandStepBuilder) UseSecretsWithPrefixes

func (b *CommandStepBuilder) UseSecretsWithPrefixes(prefixes []string)

type CommandWrapper

type CommandWrapper struct {
	Command plan.Command
}

func (CommandWrapper) IsSpread

func (c CommandWrapper) IsSpread() bool

type DeployBuilder

type DeployBuilder struct {
	Inputs      []plan.Input
	StartCmd    string
	Variables   map[string]string
	Paths       []string
	AptPackages []string
}

func NewDeployBuilder

func NewDeployBuilder() *DeployBuilder

func (*DeployBuilder) Build

func (b *DeployBuilder) Build() plan.Deploy

type GenerateContext

type GenerateContext struct {
	App    *a.App
	Env    *a.Environment
	Config *config.Config

	BaseImage string
	Steps     []StepBuilder
	Deploy    *DeployBuilder

	Caches  *CacheContext
	Secrets []string

	SubContexts []string

	Metadata        *Metadata
	Resolver        *resolver.Resolver
	MiseStepBuilder *MiseStepBuilder

	Logger *logger.Logger
}

func NewGenerateContext

func NewGenerateContext(app *a.App, env *a.Environment, config *config.Config, logger *logger.Logger) (*GenerateContext, error)

func (*GenerateContext) DefaultRuntimeInput

func (c *GenerateContext) DefaultRuntimeInput() plan.Input

func (*GenerateContext) DefaultRuntimeInputWithPackages

func (c *GenerateContext) DefaultRuntimeInputWithPackages(additionalAptPackages []string) plan.Input

func (*GenerateContext) EnterSubContext

func (c *GenerateContext) EnterSubContext(subContext string) *GenerateContext

func (*GenerateContext) ExitSubContext

func (c *GenerateContext) ExitSubContext() *GenerateContext

func (*GenerateContext) Generate

Generate a build plan from the context

func (*GenerateContext) GetMiseStepBuilder

func (c *GenerateContext) GetMiseStepBuilder() *MiseStepBuilder

func (*GenerateContext) GetStepByName

func (c *GenerateContext) GetStepByName(name string) *StepBuilder

func (*GenerateContext) GetStepName

func (c *GenerateContext) GetStepName(name string) string

func (*GenerateContext) NewAptStepBuilder

func (c *GenerateContext) NewAptStepBuilder(name string) *AptStepBuilder

func (*GenerateContext) NewCommandStep

func (c *GenerateContext) NewCommandStep(name string) *CommandStepBuilder

func (*GenerateContext) NewImageStep

func (c *GenerateContext) NewImageStep(name string, resolveStepImage func(options *BuildStepOptions) string) *ImageStepBuilder

func (*GenerateContext) NewInstallBinStepBuilder

func (c *GenerateContext) NewInstallBinStepBuilder(name string) *InstallBinStepBuilder

func (*GenerateContext) NewMiseStepBuilder

func (c *GenerateContext) NewMiseStepBuilder(displayName string) *MiseStepBuilder

func (*GenerateContext) ResolvePackages

func (c *GenerateContext) ResolvePackages() (map[string]*resolver.ResolvedPackage, error)

func (*GenerateContext) TemplateFiles

func (c *GenerateContext) TemplateFiles(potentialFiles []string, defaultContents string, data map[string]interface{}) (*TemplateFileResult, error)

TemplateFiles will look the first file that exists in the list of potential files and render it with the given data If no file is found, it will use the default contents and render it with the given data

type ImageStepBuilder

type ImageStepBuilder struct {
	DisplayName      string
	Resolver         *resolver.Resolver
	Packages         []*resolver.PackageRef
	ResolveStepImage func(options *BuildStepOptions) string
	AptPackages      []string
}

func (*ImageStepBuilder) Build

func (b *ImageStepBuilder) Build(options *BuildStepOptions) (*plan.Step, error)

func (*ImageStepBuilder) Default

func (b *ImageStepBuilder) Default(name string, defaultVersion string) resolver.PackageRef

func (*ImageStepBuilder) Name

func (b *ImageStepBuilder) Name() string

func (*ImageStepBuilder) SetVersionAvailable

func (b *ImageStepBuilder) SetVersionAvailable(ref resolver.PackageRef, isVersionAvailable func(version string) bool)

func (*ImageStepBuilder) Version

func (b *ImageStepBuilder) Version(name resolver.PackageRef, version string, source string)

type InstallBinStepBuilder

type InstallBinStepBuilder struct {
	DisplayName           string
	Resolver              *resolver.Resolver
	SupportingAptPackages []string
	Package               resolver.PackageRef
}

func (*InstallBinStepBuilder) Build

func (b *InstallBinStepBuilder) Build(options *BuildStepOptions) (*plan.Step, error)

func (*InstallBinStepBuilder) Default

func (b *InstallBinStepBuilder) Default(name string, defaultVersion string) resolver.PackageRef

func (*InstallBinStepBuilder) GetOutputPaths

func (b *InstallBinStepBuilder) GetOutputPaths() []string

func (*InstallBinStepBuilder) Name

func (b *InstallBinStepBuilder) Name() string

func (*InstallBinStepBuilder) Version

func (b *InstallBinStepBuilder) Version(name resolver.PackageRef, version string, source string)

type Metadata

type Metadata struct {
	Properties map[string]string `json:"properties"`
}

func NewMetadata

func NewMetadata() *Metadata

func (*Metadata) Get

func (m *Metadata) Get(key string) string

func (*Metadata) Set

func (m *Metadata) Set(key string, value string)

func (*Metadata) SetBool

func (m *Metadata) SetBool(key string, value bool)

type MiseStepBuilder

type MiseStepBuilder struct {
	DisplayName           string
	Resolver              *resolver.Resolver
	SupportingAptPackages []string
	MisePackages          []*resolver.PackageRef
	SupportingMiseFiles   []string
	Assets                map[string]string
	Inputs                []plan.Input
	Variables             map[string]string
	// contains filtered or unexported fields
}

func (*MiseStepBuilder) AddInput

func (b *MiseStepBuilder) AddInput(input plan.Input)

func (*MiseStepBuilder) AddSupportingAptPackage

func (b *MiseStepBuilder) AddSupportingAptPackage(name string)

func (*MiseStepBuilder) Build

func (b *MiseStepBuilder) Build(options *BuildStepOptions) (*plan.Step, error)

func (*MiseStepBuilder) Default

func (b *MiseStepBuilder) Default(name string, defaultVersion string) resolver.PackageRef

func (*MiseStepBuilder) GetOutputPaths

func (b *MiseStepBuilder) GetOutputPaths() []string

func (*MiseStepBuilder) GetSupportingMiseConfigFiles

func (b *MiseStepBuilder) GetSupportingMiseConfigFiles(path string) []string

func (*MiseStepBuilder) Name

func (b *MiseStepBuilder) Name() string

func (*MiseStepBuilder) Version

func (b *MiseStepBuilder) Version(name resolver.PackageRef, version string, source string)

type StepBuilder

type StepBuilder interface {
	Name() string
	Build(options *BuildStepOptions) (*plan.Step, error)
}

type TemplateFileResult

type TemplateFileResult struct {
	Filename string
	Contents string
}

Jump to

Keyboard shortcuts

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