Documentation
¶
Index ¶
- Constants
- func EnvMapToSlice(envMap map[string]corev1.EnvVar) []corev1.EnvVar
- func MangleToRfc1035Label(body string, suffix string) string
- func PipelineRunName(pipelineIdentifier string, buildIdentifier 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" // DefaultStageNameForBuildPack - the name we use for the single stage created from build packs currently. DefaultStageNameForBuildPack = "from-build-pack" )
const GitMergeImage = "rawlingsj/builder-jx:wip34"
GitMergeImage is the default image name that is used in the git merge step of a pipeline
Variables ¶
This section is empty.
Functions ¶
func EnvMapToSlice ¶ added in v1.3.1108
EnvMapToSlice transforms a map of environment variables into a slice that can be used in container configuration
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)
func PipelineRunName ¶ added in v1.3.1070
PipelineRunName returns the pipeline name given the pipeline and build identifier
Types ¶
type Agent ¶
type Agent struct {
// One of label or image is required.
Label string `json:"label,omitempty"`
Image string `json:"image,omitempty"`
}
Agent defines where the pipeline, stage, or step should run.
type Loop ¶
type Loop struct {
// The variable name.
Variable string `json:"variable"`
// The list of values to iterate over
Values []string `json:"values"`
// The steps to run
Steps []Step `json:"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 `json:"agent,omitempty"`
Environment []EnvVar `json:"environment,omitempty"`
Options RootOptions `json:"options,omitempty"`
Stages []Stage `json:"stages"`
Post []Post `json:"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, podTemplates map[string]*corev1.Pod, taskParams []tektonv1alpha1.TaskParam, sourceDir string) (*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(context context.Context) *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 `json:"condition"`
Actions []PostAction `json:"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 `json:"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 `json:"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 `json:"timeout,omitempty"`
// TODO: Not yet implemented in build-pipeline
Retry int8 `json:"retry,omitempty"`
// ContainerOptions allows for advanced configuration of containers for a single stage or the whole
// pipeline, adding to configuration that can be configured through the syntax already. This includes things
// like CPU/RAM requests/limits, secrets, ports, etc. Some of these things will end up with native syntax approaches
// down the road.
ContainerOptions *corev1.Container `json:"containerOptions,omitempty"`
}
RootOptions contains options that can be configured on either a pipeline or a stage
type Stage ¶
type Stage struct {
Name string `json:"name"`
Agent Agent `json:"agent,omitempty"`
Options StageOptions `json:"options,omitempty"`
Environment []EnvVar `json:"environment,omitempty"`
Steps []Step `json:"steps,omitempty"`
Stages []Stage `json:"stages,omitempty"`
Parallel []Stage `json:"parallel,omitempty"`
Post []Post `json:"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 `json:",inline"`
// TODO: Not yet implemented in build-pipeline
Stash Stash `json:"stash,omitempty"`
Unstash Unstash `json:"unstash,omitempty"`
Workspace *string `json:"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 `json:"name"`
// Eventually make this optional so that you can do volumes instead
Files string `json:"files"`
}
Stash defines files to be saved for use in a later stage, marked with a name
type Step ¶
type Step struct {
// An optional name to give the step for reporting purposes
Name string `json:"name,omitempty"`
// One of command, step, or loop is required.
Command string `json:"command,omitempty"`
// args is optional, but only allowed with command
Arguments []string `json:"args,omitempty"`
// dir is optional, but only allowed with command. Refers to subdirectory of workspace
Dir string `json:"dir,omitempty"`
Step string `json:"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 `json:"options,omitempty"`
Loop Loop `json:"loop,omitempty"`
// agent can be overridden on a step
Agent Agent `json:"agent,omitempty"`
// Image alows the docker image for a step to be specified
Image string `json:"image,omitempty"`
}
Step defines a single step, from the author's perspective, to be executed within a stage.
type Timeout ¶
type Timeout struct {
Time int64 `json:"time"`
// Has some sane default - probably seconds
Unit TimeoutUnit `json:"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.