Documentation ¶
Index ¶
- Constants
- func DefaultFromYamlCRDLabels() map[string]string
- func MangleToRfc1035Label(body string, suffix string) string
- type Agent
- type EnvVar
- type Loop
- type ParsedPipeline
- type Post
- type PostAction
- type PostCondition
- type RootOptions
- type Stage
- type StageOptions
- type Stash
- type Step
- type Timeout
- type TimeoutUnit
- type Unstash
Constants ¶
const ( // TektonAPIVersion the APIVersion for using Tekton TektonAPIVersion = "tekton.dev/v1alpha1" // LabelStageName - the name for the label that will have the stage name on the Task. LabelStageName = "jenkins.io/task-stage-name" // LabelPipelineFromYaml - if true, the CRD was created by translation from YAML, rather than from a build pack. LabelPipelineFromYaml = "jenkins.io/pipeline-from-yaml" )
Variables ¶
This section is empty.
Functions ¶
func DefaultFromYamlCRDLabels ¶
DefaultFromYamlCRDLabels returns a map of labels that will be applied to every Tekton CRD generated from YAML syntax
func MangleToRfc1035Label ¶
MangleToRfc1035Label - Task/Step names need to be RFC 1035/1123 compliant DNS labels, so we mangle them to make them compliant. Results should match the following regex and be no more than 63 characters long:
[a-z]([-a-z0-9]*[a-z0-9])?
cf. https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names body is assumed to have at least one ASCII letter. suffix is assumed to be alphanumeric and non-empty. TODO: Combine with kube.ToValidName (that function needs to handle lengths)
Types ¶
type Agent ¶
type Agent struct { // One of label or image is required. Label string `yaml:"label,omitempty"` Image string `yaml:"image,omitempty"` }
Agent defines where the pipeline, stage, or step should run.
type Loop ¶
type Loop struct { // The variable name. Variable string `yaml:"variable"` // The list of values to iterate over Values []string `yaml:"values"` // The steps to run Steps []Step `yaml:"steps"` }
Loop is a special step that defines a variable, a list of possible values for that variable, and a set of steps to repeat for each value for the variable, with the variable set with that value in the environment for the execution of those steps.
type ParsedPipeline ¶
type ParsedPipeline struct { Agent Agent `yaml:"agent,omitempty"` Environment []EnvVar `yaml:"environment,omitempty"` Options RootOptions `yaml:"options,omitempty"` Stages []Stage `yaml:"stages"` Post []Post `yaml:"post,omitempty"` }
ParsedPipeline is the internal representation of the Pipeline, used to validate and create CRDs
func (*ParsedPipeline) GenerateCRDs ¶
func (j *ParsedPipeline) GenerateCRDs(pipelineIdentifier string, buildIdentifier string, namespace string, suffix string, podTemplates map[string]*corev1.Pod) (*tektonv1alpha1.Pipeline, []*tektonv1alpha1.Task, *v1.PipelineStructure, error)
GenerateCRDs translates the Pipeline structure into the corresponding Pipeline and Task CRDs
func (*ParsedPipeline) Validate ¶
func (j *ParsedPipeline) Validate() *apis.FieldError
Validate checks the parsed ParsedPipeline to find any errors in it. TODO: Improve validation to actually return all the errors via the nested errors? TODO: Add validation for the not-yet-supported-for-CRD-generation sections
type Post ¶
type Post struct { // TODO: Conditional execution of something after a Task or Pipeline completes is not yet implemented Condition PostCondition `yaml:"condition"` Actions []PostAction `yaml:"actions"` }
Post contains a PostCondition and one more actions to be executed after a pipeline or stage if the condition is met.
type PostAction ¶
type PostAction struct { // TODO: Notifications are not yet supported in Build Pipeline per se. Name string `yaml:"name"` // Also, we'll need to do some magic to do type verification during translation - i.e., this action wants a number // for this option, so translate the string value for that option to a number. Options map[string]string `yaml:"options,omitempty"` }
PostAction contains the name of a built-in post action and options to pass to that action.
type PostCondition ¶
type PostCondition string
PostCondition is used to specify under what condition a post action should be executed.
const ( PostConditionSuccess PostCondition = "success" PostConditionFailure PostCondition = "failure" PostConditionAlways PostCondition = "always" )
Probably extensible down the road
type RootOptions ¶
type RootOptions struct { Timeout Timeout `yaml:"timeout,omitempty"` // TODO: Not yet implemented in build-pipeline Retry int8 `yaml:"retry,omitempty"` }
RootOptions contains options that can be configured on either a pipeline or a stage
type Stage ¶
type Stage struct { Name string `yaml:"name"` Agent Agent `yaml:"agent,omitempty"` Options StageOptions `yaml:"options,omitempty"` Environment []EnvVar `yaml:"environment,omitempty"` Steps []Step `yaml:"steps,omitempty"` Stages []Stage `yaml:"stages,omitempty"` Parallel []Stage `yaml:"parallel,omitempty"` Post []Post `yaml:"post,omitempty"` }
Stage is a unit of work in a pipeline, corresponding either to a Task or a set of Tasks to be run sequentially or in parallel with common configuration.
type StageOptions ¶
type StageOptions struct { RootOptions `yaml:",inline"` // TODO: Not yet implemented in build-pipeline Stash Stash `yaml:"stash,omitempty"` Unstash Unstash `yaml:"unstash,omitempty"` Workspace *string `yaml:"workspace,omitempty"` }
StageOptions contains both options that can be configured on either a pipeline or a stage, via RootOptions, or stage-specific options.
type Stash ¶
type Stash struct { Name string `yaml:"name"` // Eventually make this optional so that you can do volumes instead Files string `yaml:"files"` }
Stash defines files to be saved for use in a later stage, marked with a name
type Step ¶
type Step struct { // One of command, step, or loop is required. Command string `yaml:"command,omitempty"` // args is optional, but only allowed with command Arguments []string `yaml:"args,omitempty"` // dir is optional, but only allowed with command. Refers to subdirectory of workspace Dir string `yaml:"dir,omitempty"` Step string `yaml:"step,omitempty"` // options is optional, but only allowed with step // Also, we'll need to do some magic to do type verification during translation - i.e., this step wants a number // for this option, so translate the string value for that option to a number. Options map[string]string `yaml:"options,omitempty"` Loop Loop `yaml:"loop,omitempty"` // agent can be overridden on a step Agent Agent `yaml:"agent,omitempty"` }
Step defines a single step, from the author's perspective, to be executed within a stage.
type Timeout ¶
type Timeout struct { Time int64 `yaml:"time"` // Has some sane default - probably seconds Unit TimeoutUnit `yaml:"unit,omitempty"` }
Timeout defines how long a stage or pipeline can run before timing out.
type TimeoutUnit ¶
type TimeoutUnit string
TimeoutUnit is used for calculating timeout duration
const ( TimeoutUnitSeconds TimeoutUnit = "seconds" TimeoutUnitMinutes TimeoutUnit = "minutes" TimeoutUnitHours TimeoutUnit = "hours" TimeoutUnitDays TimeoutUnit = "days" )
The available time units.