entrypoint

package
v0.62.3 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: Apache-2.0 Imports: 24 Imported by: 11

Documentation

Index

Constants

View Source
const (
	ContinueOnError = "continue"
	FailOnError     = "stopAndFail"
)

RFC3339 with millisecond

Variables

View Source
var (
	// ErrContextDeadlineExceeded is the error returned when the context deadline is exceeded
	ErrContextDeadlineExceeded = ContextError(context.DeadlineExceeded.Error())
	// ErrContextCanceled is the error returned when the context is canceled
	ErrContextCanceled = ContextError(context.Canceled.Error())
	// ErrSkipPreviousStepFailed is the error returned when the step is skipped due to previous step error
	ErrSkipPreviousStepFailed = SkipError("error file present, bail and skip the step")
)
View Source
var ScriptDir = pipeline.ScriptDir

ScriptDir for testing

Functions

func IsContextCanceledError added in v0.53.0

func IsContextCanceledError(err error) bool

IsContextCanceledError determine whether the error is context canceled

func IsContextDeadlineError added in v0.53.0

func IsContextDeadlineError(err error) bool

IsContextDeadlineError determine whether the error is context deadline

Types

type ArtifactTemplate added in v0.59.0

type ArtifactTemplate struct {
	ContainerName string
	Type          string // inputs or outputs
	ArtifactName  string
}

ArtifactTemplate holds steps artifacts metadata parsed from step artifacts interpolation

type ContextError added in v0.53.0

type ContextError string

ContextError context error type

func (ContextError) Error added in v0.53.0

func (e ContextError) Error() string

Error implements error interface

type Entrypointer

type Entrypointer struct {
	// Command is the original specified command and args.
	Command []string

	// WaitFiles is the set of files to wait for. If empty, execution
	// begins immediately.
	WaitFiles []string
	// WaitFileContent indicates the WaitFile should have non-zero size
	// before continuing with execution.
	WaitFileContent bool
	// PostFile is the file to write when complete. If not specified, no
	// file is written.
	PostFile string

	// Termination path is the path of a file to write the starting time of this endpopint
	TerminationPath string

	// Waiter encapsulates waiting for files to exist.
	Waiter Waiter
	// Runner encapsulates running commands.
	Runner Runner
	// PostWriter encapsulates writing files when complete.
	PostWriter PostWriter

	// StepResults is the set of files that might contain step results
	StepResults []string
	// Results is the set of files that might contain task results
	Results []string
	// Timeout is an optional user-specified duration within which the Step must complete
	Timeout *time.Duration
	// BreakpointOnFailure helps determine if entrypoint execution needs to adapt debugging requirements
	BreakpointOnFailure bool
	// OnError defines exiting behavior of the entrypoint
	// set it to "stopAndFail" to indicate the entrypoint to exit the taskRun if the container exits with non zero exit code
	// set it to "continue" to indicate the entrypoint to continue executing the rest of the steps irrespective of the container exit code
	OnError string
	// StepMetadataDir is the directory for a step where the step related metadata can be stored
	StepMetadataDir string
	// SpireWorkloadAPI connects to spire and does obtains SVID based on taskrun
	SpireWorkloadAPI spire.EntrypointerAPIClient
	// ResultsDirectory is the directory to find results, defaults to pipeline.DefaultResultPath
	ResultsDirectory string
	// ResultExtractionMethod is the method using which the controller extracts the results from the task pod.
	ResultExtractionMethod string

	// StepWhenExpressions     a list of when expression to decide if the step should be skipped
	StepWhenExpressions v1.StepWhenExpressions

	// ArtifactsDirectory is the directory to find artifacts, defaults to pipeline.ArtifactsDir
	ArtifactsDirectory string
}

Entrypointer holds fields for running commands with redirected entrypoints.

func (Entrypointer) BreakpointExitCode added in v0.26.0

func (e Entrypointer) BreakpointExitCode(breakpointExitPostFile string) (int, error)

BreakpointExitCode reads the post file and returns the exit code it contains

func (Entrypointer) Go

func (e Entrypointer) Go() error

Go optionally waits for a file, runs the command, and writes a post file.

func (Entrypointer) WriteExitCodeFile added in v0.27.0

func (e Entrypointer) WriteExitCodeFile(stepPath, content string)

WriteExitCodeFile write the exitCodeFile

func (Entrypointer) WritePostFile added in v0.2.0

func (e Entrypointer) WritePostFile(postFile string, err error)

WritePostFile write the postfile

type PostWriter

type PostWriter interface {
	// Write writes to the path when complete.
	Write(file, content string)
}

PostWriter encapsulates writing a file when complete.

type Runner

type Runner interface {
	Run(ctx context.Context, args ...string) error
}

Runner encapsulates running commands.

type SkipError added in v0.57.0

type SkipError string

func (SkipError) Error added in v0.57.0

func (e SkipError) Error() string

type Waiter

type Waiter interface {
	// Wait blocks until the specified file exists or the context is done.
	Wait(ctx context.Context, file string, expectContent bool, breakpointOnFailure bool) error
}

Waiter encapsulates waiting for files to exist.

Jump to

Keyboard shortcuts

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