models

package
v1.13.0-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildRepoURL

func BuildRepoURL(repo *tangled.Pipeline_TriggerRepo, devMode bool) string

BuildRepoURL constructs the repository URL from repo metadata.

func LogFilePath

func LogFilePath(baseDir string, workflowID WorkflowId) string

func PipelineEnvVars

func PipelineEnvVars(tr *tangled.Pipeline_TriggerMetadata, pipelineId PipelineId, devMode bool) map[string]string

PipelineEnvVars extracts environment variables from pipeline trigger metadata. These are framework-provided variables that are injected into workflow steps.

Types

type CloneStep

type CloneStep struct {
	// contains filtered or unexported fields
}

func BuildCloneStep

BuildCloneStep generates git clone commands. The caller must ensure the current working directory is set to the desired workspace directory before executing these commands.

The generated commands are: - git init - git remote add origin <url> - git fetch --depth=<d> --recurse-submodules=<yes|no> <sha> - git checkout FETCH_HEAD

Supports all trigger types (push, PR, manual) and clone options.

func (CloneStep) Command

func (s CloneStep) Command() string

func (CloneStep) Commands

func (s CloneStep) Commands() []string

func (CloneStep) Kind

func (s CloneStep) Kind() StepKind

func (CloneStep) Name

func (s CloneStep) Name() string

type Engine

type Engine interface {
	InitWorkflow(twf tangled.Pipeline_Workflow, tpl tangled.Pipeline) (*Workflow, error)
	SetupWorkflow(ctx context.Context, wid WorkflowId, wf *Workflow, wfLogger WorkflowLogger) error
	WorkflowTimeout() time.Duration
	DestroyWorkflow(ctx context.Context, wid WorkflowId) error
	RunStep(ctx context.Context, wid WorkflowId, w *Workflow, idx int, secrets []secrets.UnlockedSecret, wfLogger WorkflowLogger) error
}

type FileWorkflowLogger

type FileWorkflowLogger struct {
	// contains filtered or unexported fields
}

func (*FileWorkflowLogger) Close

func (l *FileWorkflowLogger) Close() error

func (*FileWorkflowLogger) ControlWriter

func (l *FileWorkflowLogger) ControlWriter(idx int, step Step, stepStatus StepStatus) io.Writer

func (*FileWorkflowLogger) DataWriter

func (l *FileWorkflowLogger) DataWriter(idx int, stream string) io.Writer

type LogKind

type LogKind string
var (
	// step log data
	LogKindData LogKind = "data"
	// indicates status of a step
	LogKindControl LogKind = "control"
)

type LogLine

type LogLine struct {
	Kind    LogKind   `json:"kind"`
	Content string    `json:"content"`
	Time    time.Time `json:"time"`
	StepId  int       `json:"step_id"`

	// fields if kind is "data"
	Stream string `json:"stream,omitempty"`

	// fields if kind is "control"
	StepStatus  StepStatus `json:"step_status,omitempty"`
	StepKind    StepKind   `json:"step_kind,omitempty"`
	StepCommand string     `json:"step_command,omitempty"`
}

func NewControlLogLine

func NewControlLogLine(idx int, step Step, status StepStatus) LogLine

func NewDataLogLine

func NewDataLogLine(idx int, content, stream string) LogLine

type NullLogger

type NullLogger struct{}

func (NullLogger) Close

func (l NullLogger) Close() error

func (NullLogger) ControlWriter

func (l NullLogger) ControlWriter(idx int, step Step, stepStatus StepStatus) io.Writer

func (NullLogger) DataWriter

func (l NullLogger) DataWriter(idx int, stream string) io.Writer

type Pipeline

type Pipeline struct {
	RepoOwner string
	RepoName  string
	Workflows map[Engine][]Workflow
}

type PipelineId

type PipelineId struct {
	Knot string
	Rkey string
}

func (*PipelineId) AtUri

func (p *PipelineId) AtUri() syntax.ATURI

type SecretMask

type SecretMask struct {
	// contains filtered or unexported fields
}

SecretMask replaces secret values in strings with "***".

func NewSecretMask

func NewSecretMask(values []string) *SecretMask

NewSecretMask creates a mask for the given secret values. Also registers base64-encoded variants of each secret.

func (*SecretMask) Mask

func (m *SecretMask) Mask(input string) string

Mask replaces all registered secret values with "***".

type StatusKind

type StatusKind string
var (
	StatusKindPending   StatusKind = "pending"
	StatusKindRunning   StatusKind = "running"
	StatusKindFailed    StatusKind = "failed"
	StatusKindTimeout   StatusKind = "timeout"
	StatusKindCancelled StatusKind = "cancelled"
	StatusKindSuccess   StatusKind = "success"

	StartStates [2]StatusKind = [2]StatusKind{
		StatusKindPending,
		StatusKindRunning,
	}
	FinishStates [4]StatusKind = [4]StatusKind{
		StatusKindFailed,
		StatusKindTimeout,
		StatusKindCancelled,
		StatusKindSuccess,
	}
)

func (StatusKind) IsFinish

func (s StatusKind) IsFinish() bool

func (StatusKind) IsStart

func (s StatusKind) IsStart() bool

func (StatusKind) String

func (s StatusKind) String() string

type Step

type Step interface {
	Name() string
	Command() string
	Kind() StepKind
}

type StepKind

type StepKind int
const (
	// steps injected by the CI runner
	StepKindSystem StepKind = iota
	// steps defined by the user in the original pipeline
	StepKindUser
)

type StepStatus

type StepStatus string

step status indicator in control log lines

var (
	StepStatusStart StepStatus = "start"
	StepStatusEnd   StepStatus = "end"
)

type Workflow

type Workflow struct {
	Steps       []Step
	Name        string
	Data        any
	Environment map[string]string
}

type WorkflowId

type WorkflowId struct {
	PipelineId
	Name string
}

func (WorkflowId) String

func (wid WorkflowId) String() string

type WorkflowLogger

type WorkflowLogger interface {
	Close() error
	DataWriter(idx int, stream string) io.Writer
	ControlWriter(idx int, step Step, stepStatus StepStatus) io.Writer
}

func NewFileWorkflowLogger

func NewFileWorkflowLogger(baseDir string, wid WorkflowId, secretValues []string) (WorkflowLogger, error)

Source Files

  • clone.go
  • engine.go
  • logger.go
  • models.go
  • pipeline.go
  • pipeline_env.go
  • secret_mask.go

Jump to

Keyboard shortcuts

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