plan

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CacheTypeShared = "shared"
	CacheTypeLocked = "locked"
)
View Source
const (
	RailpackBuilderImage = "ghcr.io/railwayapp/railpack-builder:latest"
	RailpackRuntimeImage = "ghcr.io/railwayapp/railpack-runtime:latest"
)

Variables

This section is empty.

Functions

func CheckAndParseDockerignore added in v0.8.0

func CheckAndParseDockerignore(app *app.App) ([]string, []string, error)

checks if a .dockerignore file exists in the app directory and parses it

func CommandsSchema

func CommandsSchema() *jsonschema.Schema

func ShellCommandString added in v0.0.31

func ShellCommandString(cmd string) string

func Spread added in v0.0.31

func Spread[T Spreadable](left []T, right []T) []T

func SpreadStrings added in v0.0.31

func SpreadStrings(left []string, right []string) []string

Types

type BuildPlan

type BuildPlan struct {
	Steps   []Step            `json:"steps,omitempty"`
	Caches  map[string]*Cache `json:"caches,omitempty"`
	Secrets []string          `json:"secrets,omitempty"`
	Deploy  Deploy            `json:"deploy,omitempty"`
}

func NewBuildPlan

func NewBuildPlan() *BuildPlan

func (*BuildPlan) AddStep

func (p *BuildPlan) AddStep(step Step)

func (*BuildPlan) Normalize added in v0.0.61

func (p *BuildPlan) Normalize()

type Cache

type Cache struct {
	Directory string `json:"directory,omitempty" jsonschema:"description=The directory to cache"`
	Type      string `` /* 133-byte string literal not displayed */
}

func NewCache

func NewCache(directory string) *Cache

type Command

type Command interface {
	CommandType() string
	Spreadable
}

func NewCopyCommand

func NewCopyCommand(src string, dst ...string) Command

func NewExecCommand

func NewExecCommand(cmd string, options ...ExecOptions) Command

func NewExecShellCommand

func NewExecShellCommand(cmd string, options ...ExecOptions) Command

func NewFileCommand

func NewFileCommand(path, name string, options ...FileOptions) Command

func NewPathCommand

func NewPathCommand(path string, customName ...string) Command

func UnmarshalCommand

func UnmarshalCommand(data []byte) (Command, error)

func UnmarshalJsonCommand

func UnmarshalJsonCommand(data []byte) (Command, error)

func UnmarshalStringCommand

func UnmarshalStringCommand(data []byte) (Command, error)

type CopyCommand

type CopyCommand struct {
	Image string `json:"image,omitempty" jsonschema:"description=Optional source image to copy from. This can be any public image URL"`
	Src   string `json:"src" jsonschema:"description=Source path to copy from. Can be a file or directory"`
	Dest  string `json:"dest" jsonschema:"description=Destination path to copy to. Will be created if it doesn't exist"`
}

CopyCommand represents copying files or directories during the build

func (CopyCommand) CommandType

func (c CopyCommand) CommandType() string

func (CopyCommand) IsSpread added in v0.0.31

func (c CopyCommand) IsSpread() bool

type Deploy added in v0.0.23

type Deploy struct {
	// The base layer for the deploy step
	Base Layer `json:"base,omitempty"`

	// The layers for the deploy step
	Inputs []Layer `json:"inputs,omitempty"`

	// The command to run in the container
	StartCmd string `json:"startCommand,omitempty"`

	// The variables available to this step. The key is the name of the variable that is referenced in a variable command
	Variables map[string]string `json:"variables,omitempty"`

	// The paths to prepend to the $PATH environment variable
	Paths []string `json:"paths,omitempty"`
}

type DockerignoreContext added in v0.8.0

type DockerignoreContext struct {
	// contains filtered or unexported fields
}

func NewDockerignoreContext added in v0.8.0

func NewDockerignoreContext(app *app.App) *DockerignoreContext

func (*DockerignoreContext) Parse added in v0.8.0

func (d *DockerignoreContext) Parse() ([]string, []string, error)

Parse parses the .dockerignore file and caches the results

func (*DockerignoreContext) ParseWithLogging added in v0.8.0

func (d *DockerignoreContext) ParseWithLogging(logger interface{ LogInfo(string, ...interface{}) }) ([]string, []string, error)

type ExecCommand

type ExecCommand struct {
	Cmd        string `json:"cmd" jsonschema:"description=The shell command to execute (e.g. 'go build' or 'npm install')"`
	CustomName string `json:"customName,omitempty" jsonschema:"description=Optional custom name to display for this command in build output"`
}

ExecCommand represents a shell command to be executed during the build

func (ExecCommand) CommandType

func (e ExecCommand) CommandType() string

func (ExecCommand) IsSpread added in v0.0.31

func (e ExecCommand) IsSpread() bool

type ExecOptions

type ExecOptions struct {
	CustomName string
}

type FileCommand

type FileCommand struct {
	Path       string      `json:"path" jsonschema:"description=Directory path where the file should be created"`
	Name       string      `json:"name" jsonschema:"description=Name of the file to create"`
	Mode       os.FileMode `json:"mode,omitempty" jsonschema:"description=Optional Unix file permissions mode (e.g. 0644 for regular file)"`
	CustomName string      `json:"customName,omitempty" jsonschema:"description=Optional custom name to display for this file operation"`
}

FileCommand represents creating or modifying a file during the build

func (FileCommand) CommandType

func (f FileCommand) CommandType() string

func (FileCommand) IsSpread added in v0.0.31

func (f FileCommand) IsSpread() bool

type FileOptions

type FileOptions struct {
	Mode       os.FileMode
	CustomName string
}

type Filter added in v0.0.61

type Filter struct {
	Include []string `json:"include,omitempty" jsonschema:"description=Files or directories to include"`
	Exclude []string `json:"exclude,omitempty" jsonschema:"description=Files or directories to exclude"`
}

func NewFilter added in v0.0.61

func NewFilter(include []string, exclude []string) Filter

func NewIncludeFilter added in v0.0.61

func NewIncludeFilter(include []string) Filter

type Layer added in v0.0.61

type Layer struct {
	Image  string `json:"image,omitempty" jsonschema:"description=The image to use as input"`
	Step   string `json:"step,omitempty" jsonschema:"description=The step to use as input"`
	Local  bool   `json:"local,omitempty" jsonschema:"description=Whether to use local files as input"`
	Spread bool   `json:"spread,omitempty" jsonschema:"description=Whether to spread the input"`

	Filter
}

func NewImageLayer added in v0.0.61

func NewImageLayer(image string, filter ...Filter) Layer

func NewLocalLayer added in v0.0.61

func NewLocalLayer() Layer

func NewStepLayer added in v0.0.61

func NewStepLayer(stepName string, filter ...Filter) Layer

func (*Layer) DisplayName added in v0.0.61

func (i *Layer) DisplayName() string

func (Layer) IsEmpty added in v0.0.61

func (i Layer) IsEmpty() bool

func (Layer) IsSpread added in v0.0.61

func (i Layer) IsSpread() bool

func (Layer) JSONSchema added in v0.0.61

func (Layer) JSONSchema() *jsonschema.Schema

func (*Layer) String added in v0.0.61

func (i *Layer) String() string

func (*Layer) UnmarshalJSON added in v0.0.61

func (i *Layer) UnmarshalJSON(data []byte) error

Supports two types of inputs:

Object Notation:

  • Step Layer: {"step": "build", "include": ["src/**/*.go"], "exclude": ["*_test.go"]} References the output of a named build step with optional file filtering
  • Image Layer: {"image": "golang:1.21", "include": ["."], "exclude": ["tmp"]} Uses a Docker image as input with optional file filtering
  • Local Layer: {"local": true, "include": ["src"], "exclude": ["node_modules"]} Uses local files from the build context with filtering

String Shortcuts: ".", "...", "$stepname"

type PathCommand

type PathCommand struct {
	Path string `` /* 167-byte string literal not displayed */
}

PathCommand represents adding a directory to the global PATH environment variable

func (PathCommand) CommandType

func (g PathCommand) CommandType() string

func (PathCommand) IsSpread added in v0.0.31

func (p PathCommand) IsSpread() bool

type PlanPackages

type PlanPackages struct {
	Apt  []string          `json:"apt,omitempty"`
	Mise map[string]string `json:"mise,omitempty"`
}

func NewPlanPackages

func NewPlanPackages() *PlanPackages

func (*PlanPackages) AddAptPackage

func (p *PlanPackages) AddAptPackage(pkg string)

func (*PlanPackages) AddMisePackage

func (p *PlanPackages) AddMisePackage(pkg string, version string)

type Spreadable added in v0.0.31

type Spreadable interface {
	IsSpread() bool
}

type Step

type Step struct {
	Name      string            `json:"name,omitempty" jsonschema:"description=The name of the step"`
	Inputs    []Layer           `json:"inputs,omitempty" jsonschema:"description=The inputs for this step"`
	Commands  []Command         `json:"commands,omitempty" jsonschema:"description=The commands to run in this step"`
	Secrets   []string          `json:"secrets,omitempty" jsonschema:"description=The secrets that this step uses"`
	Assets    map[string]string `` /* 153-byte string literal not displayed */
	Variables map[string]string `` /* 166-byte string literal not displayed */
	Caches    []string          `` /* 161-byte string literal not displayed */
}

func NewStep

func NewStep(name string) *Step

func (*Step) AddCommands

func (s *Step) AddCommands(commands []Command)

func (Step) JSONSchemaExtend

func (Step) JSONSchemaExtend(schema *jsonschema.Schema)

func (*Step) UnmarshalJSON

func (s *Step) UnmarshalJSON(data []byte) error

type StringWrapper added in v0.0.31

type StringWrapper struct {
	Value string
}

func (StringWrapper) IsSpread added in v0.0.31

func (s StringWrapper) IsSpread() bool

Jump to

Keyboard shortcuts

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