plan

package
v0.0.35 Latest Latest
Warning

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

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

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

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)

type Cache

type Cache struct {
	// The directory to cache
	Directory string `json:"directory,omitempty" jsonschema:"description=The directory to cache"`

	// The type of cache (either "shared" or "locked")
	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 inputs for the deploy step
	Inputs []Input `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 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 Input added in v0.0.23

type Input 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"`
	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 NewImageInput added in v0.0.23

func NewImageInput(image string, options ...InputOptions) Input

func NewLocalInput added in v0.0.23

func NewLocalInput(path string) Input

func NewStepInput added in v0.0.23

func NewStepInput(stepName string, options ...InputOptions) Input

func (Input) IsSpread added in v0.0.31

func (i Input) IsSpread() bool

func (Input) JSONSchema added in v0.0.31

func (Input) JSONSchema() *jsonschema.Schema

func (*Input) String added in v0.0.23

func (i *Input) String() string

func (*Input) UnmarshalJSON added in v0.0.31

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

type InputOptions added in v0.0.23

type InputOptions struct {
	Include []string
	Exclude []string
}

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    []Input           `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