shell

package
v1.0.779 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultInterpreter string
View Source
var DefaultInterpreterArgs []string

Functions

func CreateCommandFromScript

func CreateCommandFromScript(ctx context.Context, script string) (*exec.Cmd, error)

CreateCommandFromScript creates an os/exec.Cmd from the script, using the interpreter specified in the shebang line if present.

func DetectDefaultInterpreter

func DetectDefaultInterpreter() (string, []string)

DetectDefaultInterpreter detects the default interpreter based on the OS.

func DetectInterpreterFromShebang

func DetectInterpreterFromShebang(script string) (string, []string)

DetectInterpreterFromShebang reads the first line of the script to detect the interpreter from the shebang line.

func TrimLine

func TrimLine(lines string, prefix string) string

Types

type Artifact

type Artifact struct {
	Path string `json:"path" yaml:"path" template:"true"`
}

+kubebuilder:object:generate=true

func (*Artifact) DeepCopy

func (in *Artifact) DeepCopy() *Artifact

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Artifact.

func (*Artifact) DeepCopyInto

func (in *Artifact) DeepCopyInto(out *Artifact)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Exec

type Exec struct {
	Script      string
	Connections connection.ExecConnections
	Checkout    *connection.GitConnection
	Artifacts   []Artifact
	EnvVars     []types.EnvVar
}

type ExecDetails

type ExecDetails struct {
	Stdout   string   `json:"stdout"`
	Stderr   string   `json:"stderr"`
	ExitCode int      `json:"exitCode"`
	Path     string   `json:"path"`
	Args     []string `json:"args"`

	// Any extra details about the command execution, e.g. git commit id, etc.
	Extra map[string]any `json:"extra,omitempty"`

	Error     error                `json:"-" yaml:"-"`
	Artifacts []artifacts.Artifact `json:"-" yaml:"-"`
}

func Run

func Run(ctx context.Context, exec Exec) (*ExecDetails, error)

func (*ExecDetails) GetArtifacts

func (e *ExecDetails) GetArtifacts() []artifacts.Artifact

func (ExecDetails) String

func (e ExecDetails) String() string

Jump to

Keyboard shortcuts

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