workflow

package
v0.0.0-...-4d712e3 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Containerize

func Containerize(next func(params map[string]interface{}) string) func(params map[string]interface{}) string

func ExecContainer

func ExecContainer(ctx context.Context, containerId string, cmd []string) ([]byte, error)

func GroovyDSLWorkflow

func GroovyDSLWorkflow(ctx workflow.Context, pipeline Pipeline) (map[string]any, error)

Types

type Agent

type Agent struct {
	None   bool    `( "none" )?`
	Docker *Docker `( "{" "docker" @@ "}" )?`
}

Agent represents the agent block in a Jenkinsfile

type Docker

type Docker struct {
	Image QuotedString `@String`
}

type DockerContainer

type DockerContainer struct {
	DockerClient *dockerClient.Client
	ContainerId  string
}

func NewDockerContainer

func NewDockerContainer(ctx context.Context, imageName string) (*DockerContainer, error)

NewDockerContainer starts a Docker container with a specified image

func (*DockerContainer) StopContainer

func (dm *DockerContainer) StopContainer(ctx context.Context, imageName string) error

type MultiKVCommand

type MultiKVCommand struct {
	Command string  `@Ident`
	Params  []Param `@@ ("," @@)*`
}

type Parallel

type Parallel []*Stage

type Param

type Param struct {
	Key   string       `@Ident ":"`
	Value QuotedString `@String`
}

type Pipeline

type Pipeline struct {
	Agent  *Agent   `"pipeline" "{" "agent" @@`
	Stages []*Stage `"stages" "{" @@+ "}"`
	Close  string   `"}"`
}

Pipeline represents the main Jenkins pipeline structure

type QuotedString

type QuotedString string

func (*QuotedString) Capture

func (o *QuotedString) Capture(values []string) error

Capture method strips quotes from the Image field

type SingleKVCommand

type SingleKVCommand struct {
	Command string       `@Ident`
	Value   QuotedString `@String`
}

type Stage

type Stage struct {
	Name     QuotedString `"stage" "(" @String ")" "{"`
	Agent    *Agent       `( "agent" @@ )?`
	Steps    []*Step      `( "steps" "{" @@+ "}" )?`
	FailFast *bool        `( "failFast" @Bool )?`
	Parallel Parallel     `( "parallel" "{" @@+ "}" )?`
	Close    string       `"}"`
}

Stage represents a stage block within stages

type StageActivities

type StageActivities struct {
}

func (*StageActivities) StageActivity

func (a *StageActivities) StageActivity(ctx context.Context, steps []*Step, agent Agent) ([]string, error)

type Step

type Step struct {
	SingleKV *SingleKVCommand `@@ |`
	MultiKV  *MultiKVCommand  `@@`
}

Step represents individual steps within a stage

func (*Step) Name

func (step *Step) Name() string

func (*Step) ToCommand

func (step *Step) ToCommand() (string, map[string]interface{})

Jump to

Keyboard shortcuts

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