tektontypes

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package tektontypes defines minimal Go types matching the tekton.dev/v1 schema for Task, TaskRun, Pipeline, and PipelineRun. JSON tags align with upstream so `kubectl apply -f` and `tkn-act` parse the same YAML identically.

Scope is intentionally narrow — only fields that the v1 implementation actually reads. Fields we don't support (sidecars, stepActions, retries, resolvers) are not parsed.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigMapSource added in v1.2.0

type ConfigMapSource struct {
	Name     string      `json:"name"`
	Items    []KeyToPath `json:"items,omitempty"`
	Optional *bool       `json:"optional,omitempty"`
}

type EmptyDirSource added in v1.2.0

type EmptyDirSource struct {
	// Medium: "" (disk-backed tmpdir) or "Memory" (tmpfs on Linux).
	Medium string `json:"medium,omitempty"`
}

type EnvVar

type EnvVar struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type HostPathSource added in v1.2.0

type HostPathSource struct {
	Path string `json:"path"`
	Type string `json:"type,omitempty"` // diagnostic only
}

type KeyToPath added in v1.2.0

type KeyToPath struct {
	Key  string `json:"key"`
	Path string `json:"path"`
}

type Metadata

type Metadata struct {
	Name        string            `json:"name"`
	Namespace   string            `json:"namespace,omitempty"`
	Labels      map[string]string `json:"labels,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
}

type Object

type Object struct {
	APIVersion string   `json:"apiVersion"`
	Kind       string   `json:"kind"`
	Metadata   Metadata `json:"metadata"`
}

Object is the common envelope shared by Task/Pipeline/TaskRun/PipelineRun.

type Param

type Param struct {
	Name  string     `json:"name"`
	Value ParamValue `json:"value"`
}

type ParamSpec

type ParamSpec struct {
	Name        string      `json:"name"`
	Type        ParamType   `json:"type,omitempty"` // default string
	Description string      `json:"description,omitempty"`
	Default     *ParamValue `json:"default,omitempty"`
}

type ParamType

type ParamType string
const (
	ParamTypeString ParamType = "string"
	ParamTypeArray  ParamType = "array"
	ParamTypeObject ParamType = "object"
)

type ParamValue

type ParamValue struct {
	Type      ParamType
	StringVal string
	ArrayVal  []string
	ObjectVal map[string]string
}

ParamValue can be a string, []string, or map[string]string. Custom JSON unmarshaler picks the right shape from the input.

func (ParamValue) MarshalJSON

func (v ParamValue) MarshalJSON() ([]byte, error)

func (*ParamValue) UnmarshalJSON

func (v *ParamValue) UnmarshalJSON(data []byte) error

type Pipeline

type Pipeline struct {
	Object `json:",inline"`
	Spec   PipelineSpec `json:"spec"`
}

type PipelineRef

type PipelineRef struct {
	Name string `json:"name"`
}

type PipelineResultSpec

type PipelineResultSpec struct {
	Name        string     `json:"name"`
	Description string     `json:"description,omitempty"`
	Value       ParamValue `json:"value"`
}

type PipelineRun

type PipelineRun struct {
	Object `json:",inline"`
	Spec   PipelineRunSpec `json:"spec"`
}

type PipelineRunSpec

type PipelineRunSpec struct {
	PipelineRef  *PipelineRef           `json:"pipelineRef,omitempty"`
	PipelineSpec *PipelineSpec          `json:"pipelineSpec,omitempty"`
	Params       []Param                `json:"params,omitempty"`
	Workspaces   []PipelineRunWSBinding `json:"workspaces,omitempty"`
}

type PipelineRunWSBinding

type PipelineRunWSBinding struct {
	Name     string    `json:"name"`
	EmptyDir *struct{} `json:"emptyDir,omitempty"`
	HostPath string    `json:"-"` // tkn-act extension; populated from CLI -w flag
}

type PipelineSpec

type PipelineSpec struct {
	Description string                  `json:"description,omitempty"`
	Params      []ParamSpec             `json:"params,omitempty"`
	Workspaces  []PipelineWorkspaceDecl `json:"workspaces,omitempty"`
	Tasks       []PipelineTask          `json:"tasks"`
	Finally     []PipelineTask          `json:"finally,omitempty"`
	Results     []PipelineResultSpec    `json:"results,omitempty"`
	Timeouts    *Timeouts               `json:"timeouts,omitempty"`
}

type PipelineTask

type PipelineTask struct {
	Name       string             `json:"name"`
	TaskRef    *TaskRef           `json:"taskRef,omitempty"`
	TaskSpec   *TaskSpec          `json:"taskSpec,omitempty"` // inline task
	Params     []Param            `json:"params,omitempty"`
	Workspaces []WorkspaceBinding `json:"workspaces,omitempty"`
	RunAfter   []string           `json:"runAfter,omitempty"`
	When       []WhenExpression   `json:"when,omitempty"`
	// Retries is the number of additional attempts after the first failure.
	// 0 (or unset) means run once.
	Retries int `json:"retries,omitempty"`
}

type PipelineWorkspaceDecl

type PipelineWorkspaceDecl struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Optional    bool   `json:"optional,omitempty"`
}

type ResourceList

type ResourceList struct {
	CPU    string `json:"cpu,omitempty"`
	Memory string `json:"memory,omitempty"`
}

type ResultSpec

type ResultSpec struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	Type        string `json:"type,omitempty"` // string|array|object; default string
}

type SecretSource added in v1.2.0

type SecretSource struct {
	SecretName string      `json:"secretName"`
	Items      []KeyToPath `json:"items,omitempty"`
	Optional   *bool       `json:"optional,omitempty"`
}

type Step

type Step struct {
	Name            string         `json:"name"`
	Image           string         `json:"image"`
	Command         []string       `json:"command,omitempty"`
	Args            []string       `json:"args,omitempty"`
	Script          string         `json:"script,omitempty"`
	Env             []EnvVar       `json:"env,omitempty"`
	WorkingDir      string         `json:"workingDir,omitempty"`
	Resources       *StepResources `json:"resources,omitempty"`
	ImagePullPolicy string         `json:"imagePullPolicy,omitempty"` // Always | IfNotPresent | Never
	// OnError controls Task-level failure semantics. "" or "stopAndFail" is
	// the default — first non-zero step exit fails the Task. "continue" lets
	// a non-zero exit be recorded but does not fail the Task.
	OnError string `json:"onError,omitempty"`
	// Results are per-step results, mounted at /tekton/steps/<step>/results/
	// in this step (RW) and in every later step in the same Task (RO).
	Results      []ResultSpec  `json:"results,omitempty"`
	VolumeMounts []VolumeMount `json:"volumeMounts,omitempty"`
}

type StepResources

type StepResources struct {
	Limits   ResourceList `json:"limits,omitempty"`
	Requests ResourceList `json:"requests,omitempty"`
}

type StepTemplate added in v1.4.0

type StepTemplate struct {
	Image           string         `json:"image,omitempty"`
	Command         []string       `json:"command,omitempty"`
	Args            []string       `json:"args,omitempty"`
	Env             []EnvVar       `json:"env,omitempty"`
	WorkingDir      string         `json:"workingDir,omitempty"`
	Resources       *StepResources `json:"resources,omitempty"`
	ImagePullPolicy string         `json:"imagePullPolicy,omitempty"`
}

StepTemplate is the partial-Step template merged into every Step in TaskSpec.Steps. Fields are inherited only when the Step doesn't set its own. Mirrors Tekton's StepTemplate (v1) for the subset of Step fields tkn-act reads. `name`, `script`, `volumeMounts`, `results`, and `onError` are NOT inheritable — they're intrinsically per-Step.

type Task

type Task struct {
	Object `json:",inline"`
	Spec   TaskSpec `json:"spec"`
}

type TaskRef

type TaskRef struct {
	Name string `json:"name"`
	Kind string `json:"kind,omitempty"` // Task|ClusterTask; default Task
}

type TaskRun

type TaskRun struct {
	Object `json:",inline"`
	Spec   TaskRunSpec `json:"spec"`
}

type TaskRunSpec

type TaskRunSpec struct {
	TaskRef    *TaskRef           `json:"taskRef,omitempty"`
	TaskSpec   *TaskSpec          `json:"taskSpec,omitempty"`
	Params     []Param            `json:"params,omitempty"`
	Workspaces []WorkspaceBinding `json:"workspaces,omitempty"`
}

type TaskSpec

type TaskSpec struct {
	Params      []ParamSpec     `json:"params,omitempty"`
	Results     []ResultSpec    `json:"results,omitempty"`
	Workspaces  []WorkspaceDecl `json:"workspaces,omitempty"`
	Steps       []Step          `json:"steps"`
	Description string          `json:"description,omitempty"`
	// Timeout is a Go duration string (e.g. "30s", "5m"). Empty means no
	// task-level timeout.
	Timeout      string        `json:"timeout,omitempty"`
	Volumes      []Volume      `json:"volumes,omitempty"`
	StepTemplate *StepTemplate `json:"stepTemplate,omitempty"`
}

type Timeouts added in v1.3.0

type Timeouts struct {
	Pipeline string `json:"pipeline,omitempty"`
	Tasks    string `json:"tasks,omitempty"`
	Finally  string `json:"finally,omitempty"`
}

Timeouts mirrors Tekton's PipelineSpec.Timeouts (tekton.dev/v1).

Each field is a Go-style time.Duration string (e.g. "30s", "5m", "2h"). Unset fields mean "no budget at this level". Validator enforces: durations parseable, none equals zero, and tasks+finally ≤ pipeline when all three are set.

type Volume added in v1.2.0

type Volume struct {
	Name      string           `json:"name"`
	EmptyDir  *EmptyDirSource  `json:"emptyDir,omitempty"`
	HostPath  *HostPathSource  `json:"hostPath,omitempty"`
	ConfigMap *ConfigMapSource `json:"configMap,omitempty"`
	Secret    *SecretSource    `json:"secret,omitempty"`
}

Volume is a Task-level volume. Exactly one of EmptyDir/HostPath/ConfigMap/ Secret must be set; any other source kind is rejected by the validator.

type VolumeMount added in v1.2.0

type VolumeMount struct {
	Name      string `json:"name"`
	MountPath string `json:"mountPath"`
	ReadOnly  bool   `json:"readOnly,omitempty"`
	SubPath   string `json:"subPath,omitempty"`
}

type WhenExpression

type WhenExpression struct {
	Input    string   `json:"input"`
	Operator string   `json:"operator"` // "in" | "notin"
	Values   []string `json:"values"`
}

type WorkspaceBinding

type WorkspaceBinding struct {
	Name      string `json:"name"`      // workspace name as declared in the Task
	Workspace string `json:"workspace"` // pipeline workspace it binds to
	SubPath   string `json:"subPath,omitempty"`
}

type WorkspaceDecl

type WorkspaceDecl struct {
	Name        string `json:"name"`
	Description string `json:"description,omitempty"`
	MountPath   string `json:"mountPath,omitempty"`
	ReadOnly    bool   `json:"readOnly,omitempty"`
	Optional    bool   `json:"optional,omitempty"`
}

Jump to

Keyboard shortcuts

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