package org.wikimedia.integration import org.codehaus.groovy.GroovyException import static org.wikimedia.integration.PipelineStage.* import org.wikimedia.integration.ExecutionContext import org.wikimedia.integration.ExecutionGraph import org.wikimedia.integration.PipelineStage import org.wikimedia.integration.PipelineRunner /** * 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
* 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
* publish:
* files: # publish select artifact files from the built/run image
* paths: ["foo/*", "bar"] # copy files {foo/*,bar} from the image fs to ./artifacts/{foo/*,bar}
* - 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
* - name: production
* deploy:
* cluster: production
* chart: http://helm/chart
* serviceTwo:
* directory: src/serviceTwo
*
*/
class Pipeline implements Serializable {
String name
String blubberfile
String directory
String dockerRegistry
String dockerRegistryInternal
private Map stagesConfig
private List