launch

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: Apache-2.0 Imports: 11 Imported by: 10

Documentation

Index

Constants

View Source
const (
	CNBDir = `/cnb`
)

Variables

View Source
var (
	LifecycleDir = filepath.Join(CNBDir, "lifecycle")
	ProcessDir   = filepath.Join(CNBDir, "process")
	LauncherPath = filepath.Join(LifecycleDir, "launcher"+exe)
)
View Source
var (
	OSExecFunc   = syscall.Exec
	DefaultShell = &BashShell{Exec: OSExecFunc}
)

Functions

func EscapeID

func EscapeID(id string) string

func GetMetadataFilePath

func GetMetadataFilePath(layersDir string) string

func ProcessPath added in v0.9.0

func ProcessPath(processType string) string

ProcessPath returns the absolute path to the symlink for a given processType

Types

type BashShell added in v0.9.0

type BashShell struct {
	Exec ExecFunc
}

func (*BashShell) Launch added in v0.9.0

func (b *BashShell) Launch(proc ShellProcess) error

Launch launches the given ShellProcess with Bash

It shall execute a Bash command that sources profile scripts and then executes the process in a nested Bash command When ShellProcess.Script is true nested Bash script shall be proc.Command with proc.Args provided as argument to Bash When ShellProcess.Script is false a Bash command shall be contructed from proc.Command and proc.Args

type Buildpack

type Buildpack struct {
	API string `toml:"api"`
	ID  string `toml:"id"`
}

type CmdShell added in v0.9.0

type CmdShell struct {
	Exec ExecFunc
}

func (*CmdShell) Launch added in v0.9.0

func (c *CmdShell) Launch(proc ShellProcess) error

Launch launches the given ShellProcess with cmd

type Env

type Env interface {
	AddRootDir(baseDir string) error
	AddEnvDir(envDir string) error
	List() []string
	Get(string) string
}

type ExecFunc added in v0.9.0

type ExecFunc func(argv0 string, argv []string, envv []string) error

type Launcher

type Launcher struct {
	AppDir             string
	Buildpacks         []Buildpack
	DefaultProcessType string
	Env                Env
	Exec               ExecFunc
	Shell              Shell
	LayersDir          string
	PlatformAPI        *api.Version
	Processes          []Process
	Setenv             func(string, string) error
}

func (*Launcher) Launch

func (l *Launcher) Launch(self string, cmd []string) error

Launch uses cmd to select a process and launches that process

For direct=false processes, self is used to set argv0 during profile script execution

func (*Launcher) LaunchProcess added in v0.9.0

func (l *Launcher) LaunchProcess(self string, process Process) error

LaunchProcess launches the provided process

For direct=false processes, self is used to set argv0 during profile script execution

func (*Launcher) ProcessFor added in v0.9.0

func (l *Launcher) ProcessFor(cmd []string) (Process, error)

ProcessFor creates a process from container cmd

If the Platform API if 0.4 or greater and DefaultProcess is set:
  * The default process is returned with `cmd` appended to the process args
If the Platform API is less than 0.4
  * If there is exactly one argument and it matches a process type, it returns that process.
  * If cmd is empty, it returns the default process
Else
  * it constructs a new process from cmd
  * If the first element in cmd is `cmd` the process shall be direct

type Metadata

type Metadata struct {
	Processes  []Process   `toml:"processes" json:"processes"`
	Buildpacks []Buildpack `toml:"buildpacks" json:"buildpacks"`
}

func (Metadata) FindProcessType added in v0.9.0

func (m Metadata) FindProcessType(kind string) (Process, bool)

type Process

type Process struct {
	Type        string   `toml:"type" json:"type"`
	Command     string   `toml:"command" json:"command"`
	Args        []string `toml:"args" json:"args"`
	Direct      bool     `toml:"direct" json:"direct"`
	BuildpackID string   `toml:"buildpack-id" json:"buildpackID"`
}

type Shell added in v0.9.0

type Shell interface {
	Launch(ShellProcess) error
}

type ShellProcess added in v0.9.0

type ShellProcess struct {
	Script   bool // Script indicates whether Command is a script or should be a token in a generated script
	Args     []string
	Command  string
	Caller   string // Caller used to set argv0 for Bash profile scripts and is ignored in Cmd
	Profiles []string
	Env      []string
}

Directories

Path Synopsis
Package testmock is a generated GoMock package.
Package testmock is a generated GoMock package.

Jump to

Keyboard shortcuts

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