plan

package
v0.0.10 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	CacheTypeShared = "shared"
	CacheTypeLocked = "locked"
)

Variables

This section is empty.

Functions

func CommandsSchema

func CommandsSchema() *jsonschema.Schema

Types

type BuildPlan

type BuildPlan struct {
	BaseImage string            `json:"baseImage,omitempty"`
	Steps     []Step            `json:"steps,omitempty"`
	Start     Start             `json:"start,omitempty"`
	Caches    map[string]*Cache `json:"caches,omitempty"`
	Secrets   []string          `json:"secrets,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
}

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

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

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

type FileOptions

type FileOptions struct {
	Mode       os.FileMode
	CustomName 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

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 Start

type Start struct {
	// The image to use for the container runtime
	BaseImage string `json:"baseImage,omitempty"`

	// The command to run in the container
	Command string `json:"cmd,omitempty"`

	// Outputs to be copied from the container to the host
	Outputs []string `json:"outputs,omitempty"`

	// $PATHs to be prefixed to the container's base $PATH
	Paths []string `json:"paths,omitempty"`

	// Environment variables to set in the container. These are not available at build time.
	Variables map[string]string `json:"variables,omitempty"`
}

type Step

type Step struct {
	// The name of the step
	Name string `json:"name,omitempty" jsonschema:"description=The name of the step"`

	// The steps that this step depends on. The step will only run after all the steps in DependsOn have run
	DependsOn []string `` /* 153-byte string literal not displayed */

	// The commands to run in this step
	Commands *[]Command `json:"commands,omitempty" jsonschema:"description=The commands to run in this step"`

	// Whether the commands executed in this step should have access to secrets
	UseSecrets *bool `json:"useSecrets,omitempty" jsonschema:"description=Whether the commands executed in this step should have access to secrets"`

	// Paths that this step outputs. Only these paths will be available to the next step
	Outputs *[]string `` /* 131-byte string literal not displayed */

	// The assets available to this step. The key is the name of the asset that is referenced in a file command
	Assets map[string]string `` /* 153-byte string literal not displayed */

	// 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 `` /* 166-byte string literal not displayed */

	// The caches available to all commands in this step. Each cache must refer to a cache at the top level of the plan
	Caches []string `` /* 161-byte string literal not displayed */

	// The base image that will be used for this step
	// If empty (default), the base image will be the one from the previous step
	// Only set this if you don't want to reuse any part of the file system from the previous step
	StartingImage string `` /* 270-byte string literal not displayed */
}

func NewStep

func NewStep(name string) *Step

func (*Step) AddCommands

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

func (*Step) DependOn

func (s *Step) DependOn(name string)

func (Step) JSONSchemaExtend

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

func (*Step) UnmarshalJSON

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

Jump to

Keyboard shortcuts

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