class Pipeline extends java.lang.Object
Defines a Jenkins Workflow based on a given configuration. The given configuration should look like this:
pipelines:
serviceOne:
blubberfile: serviceOne/blubber.yaml # default based on service name for the dir
directory: src/serviceOne
fetch:
shallow: true # Perform a shallow clone
depth: 2 # Git fetch depth
submodules: true # Checkout submodules
tags: true # Fetch all remote tags
notify:
email:
to: [engprod@lists.wikimedia.org] # email failures
execution: # directed graph of stages to run
- [unit, candidate] # each arc is represented horizontally
- [lint, candidate]
- [candidate, staging, production] # common segments of arcs can be defined separately too
stages: # stage defintions
- name: unit # stage name (required)
build: phpunit # build an image variant
run: "${.imageID}" # run the built image
copy: # copy files from a previously run container
- source: "foo/*" # copy files foo/* from the container fs
destination: "output/" # copy files into output/
- name: lint # default (build/run "lint" variant, no artifacts, etc.)
- name: candidate
build: production
publish:
image: # publish built image to our docker registry
id: "${.imageID}" # image reference
name: "${setup.project}" # image name
tag: "${setup.timestamp}-${.stage}" # primary tag
tags: [candidate] # additional tags
exports: # export stage values under new names
image: "${.imageFullName}:${.imageTag}" # new variable name and interpolated value
- name: staging
deploy: # deploy image to a cluster
image: "${candidate.image}" # image name:tag reference
cluster: ci # default "ci" k8s cluster
chart: http://helm/chart # helm chart to use for deployment
test: true # run `helm test` on deployment
overrides: # provide additional values to helm chart
test:
image: "tester"
tag: "stable"
- name: production
deploy:
cluster: production
chart: http://helm/chart
serviceTwo:
directory: src/serviceTwo
Modifiers | Name | Description |
---|---|---|
class |
Pipeline.ValidationException |
Type | Name and description |
---|---|
java.lang.String |
blubberfile |
java.lang.String |
directory |
java.util.Map |
fetchOptions |
java.lang.String |
name |
java.util.Map |
notify |
Constructor and description |
---|
Pipeline
(java.lang.String pipelineName, java.util.Map config, java.util.Map overrides = [:], java.util.List allowedActions = null) Constructs a new pipeline with the given name and configuration. |
Type Params | Return Type | Name and description |
---|---|---|
|
java.util.Set |
getRequiredNodeLabels() Returns a set of node labels that will be required for this pipeline to function correctly. |
|
PipelineRunner |
runner(java.lang.Object ws) Returns a PipelineRunner for this pipeline and the given workflow script object. |
|
java.util.List |
stack() Returns the pipeline's stage stack bound with an execution context. |
|
void |
validate() Validates the pipeline configuration, throwing a ValidationException if anything is amiss. |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long), java.lang.Object#wait(long, int), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Constructs a new pipeline with the given name and configuration.
Returns a set of node labels that will be required for this pipeline to function correctly.
Returns a PipelineRunner for this pipeline and the given workflow script object.
Returns the pipeline's stage stack bound with an execution context.
Validates the pipeline configuration, throwing a ValidationException if anything is amiss.
Groovy Documentation