Documentation ¶
Index ¶
- Constants
- func InitBuildPack(gitter gits.Gitter, packURL string, packRef string) (string, error)
- func WriteJenkinsfileStatements(indentCount int, statements []*Statement) string
- type CreateJenkinsfileArguments
- type ImportFile
- type ImportFileResolver
- type Module
- type ModuleResolver
- type Modules
- type ModulesResolver
- type PipelineAgent
- type PipelineConfig
- type PipelineExtends
- type PipelineLifecycle
- type PipelineLifecycleArray
- type PipelineLifecycles
- type PipelineStep
- type Pipelines
- type Statement
- type Writer
Constants ¶
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" )
const (
// ModuleFileName the name of the module imports file name
ModuleFileName = "imports.yaml"
)
Variables ¶
This section is empty.
Functions ¶
func InitBuildPack ¶ added in v1.3.581
InitBuildPack initialises the build pack URL and git ref returning the packs dir or an error
func WriteJenkinsfileStatements ¶
WriteJenkinsfileStatements writes the given Jenkinsfile statements as a string
Types ¶
type CreateJenkinsfileArguments ¶
type CreateJenkinsfileArguments struct { ConfigFile string TemplateFile string OutputFile string JenkinsfileRunner bool }
CreateJenkinsfileArguments contains the arguents to generate a Jenkinsfiles dynamically
func (*CreateJenkinsfileArguments) GenerateJenkinsfile ¶
func (a *CreateJenkinsfileArguments) GenerateJenkinsfile(resolver ImportFileResolver) error
GenerateJenkinsfile generates the jenkinsfile
func (*CreateJenkinsfileArguments) Validate ¶
func (a *CreateJenkinsfileArguments) Validate() error
Validate validates all the arguments are set correctly
type ImportFile ¶
ImportFile represents an import of a file from a module (usually a version of a git repo)
type ImportFileResolver ¶
type ImportFileResolver func(importFile *ImportFile) (string, error)
ImportFileResolver resolves a build pack file resolver strategy
type Module ¶
type Module struct { Name string `yaml:"name,omitempty"` GitURL string `yaml:"gitUrl,omitempty"` GitRef string `yaml:"gitRef,omitempty"` }
Module defines a dependent module for a build pack
type ModuleResolver ¶ added in v1.3.581
ModuleResolver a resolver for a single module
type Modules ¶
type Modules struct {
Modules []*Module `yaml:"modules,omitempty"`
}
Modules defines the dependent modules for a build pack
func LoadModules ¶ added in v1.3.581
LoadModules loads the modules in the given build pack directory if there are any
type ModulesResolver ¶ added in v1.3.581
type ModulesResolver struct {
Modules map[string]*ModuleResolver
}
ModulesResolver resolves a number of modules into a structure we can use to resolve imports
func (*ModulesResolver) AsImportResolver ¶ added in v1.3.581
func (m *ModulesResolver) AsImportResolver() ImportFileResolver
AsImportResolver returns an ImportFileResolver for these modules
func (*ModulesResolver) ResolveImport ¶ added in v1.3.581
func (m *ModulesResolver) ResolveImport(importFile *ImportFile) (string, error)
ResolveImport resolves an import relative to the local git clone of the import
type PipelineAgent ¶
type PipelineAgent struct { Label string `yaml:"label,omitempty"` Container string `yaml:"container,omitempty"` }
PipelineAgent contains the agent definition metadata
func (*PipelineAgent) Groovy ¶
func (a *PipelineAgent) Groovy() string
Groovy returns the agent groovy expression for the agent or `any` if its black
type PipelineConfig ¶
type PipelineConfig struct { Extends *PipelineExtends `yaml:"extends,omitempty"` Agent PipelineAgent `yaml:"agent,omitempty"` Environment string `yaml:"environment,omitempty"` Pipelines Pipelines `yaml:"pipelines,omitempty"` }
PipelineConfig defines the pipeline configuration
func LoadPipelineConfig ¶
func LoadPipelineConfig(fileName string, resolver ImportFileResolver, jenkinsfileRunner bool) (*PipelineConfig, error)
LoadPipelineConfig returns the pipeline configuration
func (*PipelineConfig) ExtendPipeline ¶
func (c *PipelineConfig) ExtendPipeline(base *PipelineConfig, jenkinsfileRunner bool) error
ExtendPipeline inherits this pipeline from the given base pipeline
func (*PipelineConfig) IsEmpty ¶
func (c *PipelineConfig) IsEmpty() bool
IsEmpty returns true if this configuration is empty
func (*PipelineConfig) SaveConfig ¶
func (c *PipelineConfig) SaveConfig(fileName string) error
SaveConfig saves the configuration file to the given project directory
type PipelineExtends ¶
type PipelineExtends struct { Import string `yaml:"import,omitempty"` File string `yaml:"file,omitempty"` }
PipelineExtends defines the extension (e.g. parent pipeline which is overloaded
func (*PipelineExtends) ImportFile ¶
func (x *PipelineExtends) ImportFile() *ImportFile
ImportFile returns an ImportFile for the given extension
type PipelineLifecycle ¶
type PipelineLifecycle struct { Steps []*PipelineStep `yaml:"steps,omitempty"` // PreSteps if using inheritance then invoke these steps before the base steps PreSteps []*PipelineStep `yaml:"preSteps,omitempty"` // Replace if using inheritence then replace steps from the base pipeline Replace bool `yaml:"replace,omitempty"` }
PipelineLifecycle defines the steps of a lifecycle section
func ExtendLifecycle ¶
func ExtendLifecycle(parent *PipelineLifecycle, base *PipelineLifecycle) *PipelineLifecycle
ExtendLifecycle extends the lifecycle with the inherited base lifecycle
func (*PipelineLifecycle) Groovy ¶
func (l *PipelineLifecycle) Groovy() string
Groovy returns the groovy expression for this lifecycle
func (*PipelineLifecycle) ToJenkinsfileStatements ¶
func (l *PipelineLifecycle) ToJenkinsfileStatements() []*Statement
ToJenkinsfileStatements converts the lifecycle to one or more jenkinsfile statements
type PipelineLifecycleArray ¶
type PipelineLifecycleArray []*PipelineLifecycle
PipelineLifecycleArray an array of lifecycle pointers
func (PipelineLifecycleArray) Groovy ¶
func (s PipelineLifecycleArray) Groovy() string
Groovy returns the groovy string for the lifecycles
type PipelineLifecycles ¶
type PipelineLifecycles struct { Setup *PipelineLifecycle `yaml:"setup,omitempty"` SetVersion *PipelineLifecycle `yaml:"setVersion,omitempty"` PreBuild *PipelineLifecycle `yaml:"preBuild,omitempty"` Build *PipelineLifecycle `yaml:"build,omitempty"` PostBuild *PipelineLifecycle `yaml:"postBuild,omitempty"` Promote *PipelineLifecycle `yaml:"promote,omitempty"` }
PipelineLifecycles defines the steps of a lifecycle section
func ExtendPipelines ¶
func ExtendPipelines(parent *PipelineLifecycles, base *PipelineLifecycles) *PipelineLifecycles
ExtendPipelines extends the parent lifecycle with the base
func (*PipelineLifecycles) All ¶
func (a *PipelineLifecycles) All() PipelineLifecycleArray
All returns all lifecycles in order
func (*PipelineLifecycles) AllButPromote ¶
func (a *PipelineLifecycles) AllButPromote() PipelineLifecycleArray
AllButPromote returns all lifecycles but promote
func (*PipelineLifecycles) Groovy ¶
func (a *PipelineLifecycles) Groovy() string
Groovy returns the groovy expression for all of the lifecycles
type PipelineStep ¶
type PipelineStep struct { Comment string `yaml:"comment,omitempty"` Container string `yaml:"container,omitempty"` Dir string `yaml:"dir,omitempty"` Command string `yaml:"sh,omitempty"` Groovy string `yaml:"groovy,omitempty"` Steps []*PipelineStep `yaml:"steps,omitempty"` }
PipelineStep defines an individual step in a pipeline, either a command (sh) or groovy block
func (*PipelineStep) GroovyBlock ¶
func (s *PipelineStep) GroovyBlock(parentIndent string) string
GroovyBlock returns the groovy expression for this step
func (*PipelineStep) ToJenkinsfileStatements ¶
func (s *PipelineStep) ToJenkinsfileStatements() []*Statement
ToJenkinsfileStatements converts the step to one or more jenkinsfile statements
type Pipelines ¶
type Pipelines struct { PullRequest *PipelineLifecycles `yaml:"pullRequest,omitempty"` Release *PipelineLifecycles `yaml:"release,omitempty"` Feature *PipelineLifecycles `yaml:"feature,omitempty"` }
Pipelines contains all the different kinds of pipeline for diferent branches
type Statement ¶
Statement represents a statement in a Jenkinsfile
func (*Statement) ContextEquals ¶
ContextEquals returns true if this statement is a context statement and it equals the same context as that statement