jx: github.com/jenkins-x/jx/pkg/jenkinsfile Index | Files | Directories

package jenkinsfile

import "github.com/jenkins-x/jx/pkg/jenkinsfile"

Index

Package Files

doc.go jenkinsfile.go modules.go pipeline.go zz_generated.deepcopy.go

Constants

const (
    // Name Jenkinsifile name
    Name = "Jenkinsfile"

    // BackupSuffix the suffix used by Jenkins for backups
    BackupSuffix = ".backup"
)
const (
    // PipelineConfigFileName is the name of the pipeline configuration file
    PipelineConfigFileName = "pipeline.yaml"

    // PipelineTemplateFileName defines the jenkisnfile template used to generate the pipeline
    PipelineTemplateFileName = "Jenkinsfile.tmpl"

    // PipelineKindRelease represents a release pipeline triggered on merge to master (or a release branch)
    PipelineKindRelease = "release"

    // PipelineKindPullRequest represents a Pull Request pipeline
    PipelineKindPullRequest = "pullrequest"

    // PipelineKindFeature represents a pipeline on a feature branch
    PipelineKindFeature = "feature"

    // CreateStepModePre creates steps before any existing steps
    CreateStepModePre = "pre"

    // CreateStepModePost creates steps after the existing steps
    CreateStepModePost = "post"

    // CreateStepModeReplace replaces the existing steps with the new steps
    CreateStepModeReplace = "replace"
)
const (
    // ModuleFileName the name of the module imports file name
    ModuleFileName = "imports.yaml"
)

Variables

var (
    // PipelineKinds the possible values of pipeline
    PipelineKinds = []string{PipelineKindRelease, PipelineKindPullRequest, PipelineKindFeature}

    // PipelineLifecycleNames the possible names of lifecycles of pipeline
    PipelineLifecycleNames = []string{"setup", "setversion", "prebuild", "build", "postbuild", "promote"}

    // CreateStepModes the step creation modes
    CreateStepModes = []string{CreateStepModePre, CreateStepModePost, CreateStepModeReplace}
)

type CreateJenkinsfileArguments Uses

type CreateJenkinsfileArguments struct {
    ConfigFile          string
    TemplateFile        string
    OutputFile          string
    JenkinsfileRunner   bool
    ClearContainerNames bool
}

CreateJenkinsfileArguments contains the arguents to generate a Jenkinsfiles dynamically

func (*CreateJenkinsfileArguments) DeepCopy Uses

func (in *CreateJenkinsfileArguments) DeepCopy() *CreateJenkinsfileArguments

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CreateJenkinsfileArguments.

func (*CreateJenkinsfileArguments) DeepCopyInto Uses

func (in *CreateJenkinsfileArguments) DeepCopyInto(out *CreateJenkinsfileArguments)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*CreateJenkinsfileArguments) GenerateJenkinsfile Uses

func (a *CreateJenkinsfileArguments) GenerateJenkinsfile(resolver ImportFileResolver) error

GenerateJenkinsfile generates the jenkinsfile

func (*CreateJenkinsfileArguments) Validate Uses

func (a *CreateJenkinsfileArguments) Validate() error

Validate validates all the arguments are set correctly

type CreatePipelineArguments Uses

type CreatePipelineArguments struct {
    Lifecycles        *PipelineLifecycles
    PodTemplates      map[string]*corev1.Pod
    CustomImage       string
    DefaultImage      string
    WorkspaceDir      string
    GitHost           string
    GitName           string
    GitOrg            string
    ProjectID         string
    DockerRegistry    string
    DockerRegistryOrg string
    KanikoImage       string
    UseKaniko         bool
    NoReleasePrepare  bool
    StepCounter       int
}

CreatePipelineArguments contains the arguments to translate a build pack into a pipeline

func (*CreatePipelineArguments) DeepCopy Uses

func (in *CreatePipelineArguments) DeepCopy() *CreatePipelineArguments

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CreatePipelineArguments.

func (*CreatePipelineArguments) DeepCopyInto Uses

func (in *CreatePipelineArguments) DeepCopyInto(out *CreatePipelineArguments)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ImportFile Uses

type ImportFile struct {
    Import string
    File   string
}

ImportFile represents an import of a file from a module (usually a version of a git repo)

func (*ImportFile) DeepCopy Uses

func (in *ImportFile) DeepCopy() *ImportFile

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ImportFile.

func (*ImportFile) DeepCopyInto Uses

func (in *ImportFile) DeepCopyInto(out *ImportFile)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ImportFileResolver Uses

type ImportFileResolver func(importFile *ImportFile) (string, error)

ImportFileResolver resolves a build pack file resolver strategy

type Module Uses

type Module struct {
    Name   string `json:"name,omitempty"`
    GitURL string `json:"gitUrl,omitempty"`
    GitRef string `json:"gitRef,omitempty"`
}

Module defines a dependent module for a build pack

func (*Module) DeepCopy Uses

func (in *Module) DeepCopy() *Module

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Module.

func (*Module) DeepCopyInto Uses

func (in *Module) DeepCopyInto(out *Module)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Module) Validate Uses

func (m *Module) Validate() error

Validate returns an error if any data is missing

type Modules Uses

type Modules struct {
    Modules []*Module `json:"modules,omitempty"`
}

Modules defines the dependent modules for a build pack

func (*Modules) DeepCopy Uses

func (in *Modules) DeepCopy() *Modules

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Modules.

func (*Modules) DeepCopyInto Uses

func (in *Modules) DeepCopyInto(out *Modules)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NamedLifecycle Uses

type NamedLifecycle struct {
    Name      string
    Lifecycle *PipelineLifecycle
}

NamedLifecycle a lifecycle and its name

func (*NamedLifecycle) DeepCopy Uses

func (in *NamedLifecycle) DeepCopy() *NamedLifecycle

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamedLifecycle.

func (*NamedLifecycle) DeepCopyInto Uses

func (in *NamedLifecycle) DeepCopyInto(out *NamedLifecycle)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*NamedLifecycle) Groovy Uses

func (l *NamedLifecycle) Groovy() string

Groovy returns the groovy expression for this lifecycle

func (*NamedLifecycle) PutAllEnvVars Uses

func (l *NamedLifecycle) PutAllEnvVars(m map[string]string)

PutAllEnvVars puts all the defined environment variables in the given map

type PipelineConfig Uses

type PipelineConfig struct {
    Extends          *PipelineExtends  `json:"extends,omitempty"`
    Agent            *syntax.Agent     `json:"agent,omitempty"`
    Env              []corev1.EnvVar   `json:"env,omitempty"`
    Environment      string            `json:"environment,omitempty"`
    Pipelines        Pipelines         `json:"pipelines,omitempty"`
    ContainerOptions *corev1.Container `json:"containerOptions,omitempty"`
}

PipelineConfig defines the pipeline configuration

func LoadPipelineConfig Uses

func LoadPipelineConfig(fileName string, resolver ImportFileResolver, jenkinsfileRunner bool, clearContainer bool) (*PipelineConfig, error)

LoadPipelineConfig returns the pipeline configuration

func LoadPipelineConfigAndMaybeValidate Uses

func LoadPipelineConfigAndMaybeValidate(fileName string, resolver ImportFileResolver, jenkinsfileRunner bool, clearContainer bool, skipYamlValidation bool) (*PipelineConfig, error)

LoadPipelineConfigAndMaybeValidate returns the pipeline configuration, optionally after validating the YAML.

func (*PipelineConfig) CreatePipelineForBuildPack Uses

func (c *PipelineConfig) CreatePipelineForBuildPack(args CreatePipelineArguments) (*syntax.ParsedPipeline, int, error)

CreatePipelineForBuildPack translates a set of lifecycles into a full pipeline.

func (*PipelineConfig) DeepCopy Uses

func (in *PipelineConfig) DeepCopy() *PipelineConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineConfig.

func (*PipelineConfig) DeepCopyInto Uses

func (in *PipelineConfig) DeepCopyInto(out *PipelineConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*PipelineConfig) ExtendPipeline Uses

func (c *PipelineConfig) ExtendPipeline(base *PipelineConfig, clearContainer bool) error

ExtendPipeline inherits this pipeline from the given base pipeline

func (*PipelineConfig) GetAllEnvVars Uses

func (c *PipelineConfig) GetAllEnvVars() map[string]string

GetAllEnvVars finds all the environment variables defined in all pipelines + steps with the first value we find

func (*PipelineConfig) IsEmpty Uses

func (c *PipelineConfig) IsEmpty() bool

IsEmpty returns true if this configuration is empty

func (*PipelineConfig) PopulatePipelinesFromDefault Uses

func (c *PipelineConfig) PopulatePipelinesFromDefault()

PopulatePipelinesFromDefault sets the Release, PullRequest, and Feature pipelines, if unset, with the Default pipeline.

func (*PipelineConfig) SaveConfig Uses

func (c *PipelineConfig) SaveConfig(fileName string) error

SaveConfig saves the configuration file to the given project directory

type PipelineExtends Uses

type PipelineExtends struct {
    Import string `json:"import,omitempty"`
    File   string `json:"file,omitempty"`
}

PipelineExtends defines the extension (e.g. parent pipeline which is overloaded

func (*PipelineExtends) DeepCopy Uses

func (in *PipelineExtends) DeepCopy() *PipelineExtends

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineExtends.

func (*PipelineExtends) DeepCopyInto Uses

func (in *PipelineExtends) DeepCopyInto(out *PipelineExtends)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*PipelineExtends) ImportFile Uses

func (x *PipelineExtends) ImportFile() *ImportFile

ImportFile returns an ImportFile for the given extension

type PipelineLifecycle Uses

type PipelineLifecycle struct {
    Steps []*syntax.Step `json:"steps,omitempty"`

    // PreSteps if using inheritance then invoke these steps before the base steps
    PreSteps []*syntax.Step `json:"preSteps,omitempty"`

    // Replace if using inheritance then replace steps from the base pipeline
    Replace bool `json:"replace,omitempty"`
}

PipelineLifecycle defines the steps of a lifecycle section

func ExtendLifecycle Uses

func ExtendLifecycle(pipelineName, stageName string, parent *PipelineLifecycle, base *PipelineLifecycle, overrides []*syntax.PipelineOverride) *PipelineLifecycle

ExtendLifecycle extends the lifecycle with the inherited base lifecycle

func (*PipelineLifecycle) CreateStep Uses

func (l *PipelineLifecycle) CreateStep(mode string, step *syntax.Step) error

CreateStep creates the given step using the mode

func (*PipelineLifecycle) DeepCopy Uses

func (in *PipelineLifecycle) DeepCopy() *PipelineLifecycle

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineLifecycle.

func (*PipelineLifecycle) DeepCopyInto Uses

func (in *PipelineLifecycle) DeepCopyInto(out *PipelineLifecycle)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*PipelineLifecycle) Groovy Uses

func (l *PipelineLifecycle) Groovy() string

Groovy returns the groovy expression for this lifecycle

func (*PipelineLifecycle) RemoveWhenStatements Uses

func (l *PipelineLifecycle) RemoveWhenStatements(prow bool)

RemoveWhenStatements removes any when conditions

func (*PipelineLifecycle) ToJenkinsfileStatements Uses

func (l *PipelineLifecycle) ToJenkinsfileStatements() []*util.Statement

ToJenkinsfileStatements converts the lifecycle to one or more jenkinsfile statements

type PipelineLifecycleArray Uses

type PipelineLifecycleArray []NamedLifecycle

PipelineLifecycleArray an array of named lifecycle pointers

func (PipelineLifecycleArray) DeepCopy Uses

func (in PipelineLifecycleArray) DeepCopy() PipelineLifecycleArray

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineLifecycleArray.

func (PipelineLifecycleArray) DeepCopyInto Uses

func (in PipelineLifecycleArray) DeepCopyInto(out *PipelineLifecycleArray)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (PipelineLifecycleArray) Groovy Uses

func (s PipelineLifecycleArray) Groovy() string

Groovy returns the groovy string for the lifecycles

type PipelineLifecycles Uses

type PipelineLifecycles struct {
    Setup      *PipelineLifecycle     `json:"setup,omitempty"`
    SetVersion *PipelineLifecycle     `json:"setVersion,omitempty"`
    PreBuild   *PipelineLifecycle     `json:"preBuild,omitempty"`
    Build      *PipelineLifecycle     `json:"build,omitempty"`
    PostBuild  *PipelineLifecycle     `json:"postBuild,omitempty"`
    Promote    *PipelineLifecycle     `json:"promote,omitempty"`
    Pipeline   *syntax.ParsedPipeline `json:"pipeline,omitempty"`
}

PipelineLifecycles defines the steps of a lifecycle section

func ExtendPipelines Uses

func ExtendPipelines(pipelineName string, parent, base *PipelineLifecycles, overrides []*syntax.PipelineOverride) *PipelineLifecycles

ExtendPipelines extends the parent lifecycle with the base

func (*PipelineLifecycles) All Uses

func (a *PipelineLifecycles) All() PipelineLifecycleArray

All returns all lifecycles in order

func (*PipelineLifecycles) AllButPromote Uses

func (a *PipelineLifecycles) AllButPromote() PipelineLifecycleArray

AllButPromote returns all lifecycles but promote

func (*PipelineLifecycles) DeepCopy Uses

func (in *PipelineLifecycles) DeepCopy() *PipelineLifecycles

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PipelineLifecycles.

func (*PipelineLifecycles) DeepCopyInto Uses

func (in *PipelineLifecycles) DeepCopyInto(out *PipelineLifecycles)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*PipelineLifecycles) GetLifecycle Uses

func (a *PipelineLifecycles) GetLifecycle(name string, lazyCreate bool) (*PipelineLifecycle, error)

GetLifecycle returns the pipeline lifecycle of the given name lazy creating on the fly if required or returns an error if the name is not valid

func (*PipelineLifecycles) Groovy Uses

func (a *PipelineLifecycles) Groovy() string

Groovy returns the groovy expression for all of the lifecycles

func (*PipelineLifecycles) RemoveWhenStatements Uses

func (a *PipelineLifecycles) RemoveWhenStatements(prow bool)

RemoveWhenStatements removes any when conditions

type Pipelines Uses

type Pipelines struct {
    PullRequest *PipelineLifecycles        `json:"pullRequest,omitempty"`
    Release     *PipelineLifecycles        `json:"release,omitempty"`
    Feature     *PipelineLifecycles        `json:"feature,omitempty"`
    Post        *PipelineLifecycle         `json:"post,omitempty"`
    Overrides   []*syntax.PipelineOverride `json:"overrides,omitempty"`
    Default     *syntax.ParsedPipeline     `json:"default,omitempty"`
}

Pipelines contains all the different kinds of pipeline for different branches

func (*Pipelines) All Uses

func (p *Pipelines) All() []*PipelineLifecycles

All returns all the lifecycles in this pipeline, some may be null

func (*Pipelines) AllMap Uses

func (p *Pipelines) AllMap() map[string]*PipelineLifecycles

AllMap returns all the lifecycles in this pipeline indexed by the pipeline name

func (*Pipelines) DeepCopy Uses

func (in *Pipelines) DeepCopy() *Pipelines

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Pipelines.

func (*Pipelines) DeepCopyInto Uses

func (in *Pipelines) DeepCopyInto(out *Pipelines)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Pipelines) Extend Uses

func (p *Pipelines) Extend(base *Pipelines) error

Extend extends these pipelines with the base pipeline

func (*Pipelines) GetPipeline Uses

func (p *Pipelines) GetPipeline(kind string, lazyCreate bool) (*PipelineLifecycles, error)

GetPipeline returns the pipeline for the given name, creating if required if lazyCreate is true or returns an error if its not a valid name

func (*Pipelines) RemoveWhenStatements Uses

func (p *Pipelines) RemoveWhenStatements(prow bool)

RemoveWhenStatements removes any prow or !prow statements

Directories

PathSynopsis
gitresolver

Package jenkinsfile imports 17 packages (graph) and is imported by 16 packages. Updated 2019-09-12. Refresh now. Tools for package owners.