summaryrefslogtreecommitdiffstats
path: root/samples
diff options
context:
space:
mode:
authorManuel Desbonnet <manuel.desbonnet@hp.com>2012-09-26 12:56:29 +0100
committerJenkins <jenkins@review.openstack.org>2012-10-30 16:32:39 +0000
commit211cd36318cbef5da2fa09baece8572682bd6953 (patch)
tree40ecfb6ea52fce910980cddd943cd14948764f64 /samples
parent8860e647a0c7c64c7f5bab9e23fee19541a584d1 (diff)
downloadpython-jenkins-job-builder-211cd36318cbef5da2fa09baece8572682bd6953.tar.gz
python-jenkins-job-builder-211cd36318cbef5da2fa09baece8572682bd6953.tar.xz
python-jenkins-job-builder-211cd36318cbef5da2fa09baece8572682bd6953.zip
Do not output XML if job name not specified ('pipeline', 'trigger-builds')
Done in order to enable specifying build pipelines at the project level. Pipelines are built using the 'pipeline' plugin or the 'trigger-builds' plugin. The downstream job to be executed is specified at the project level, and substituted into the template. Ignoring definitions where the downstream job is blank allows the pipeline to be easily terminated. Also adding a samples/ directory, which currently contains an example of pipeline creation, together with a new tools/run-compare-xml-samples.sh to run the before/after test on the samples. Change-Id: Icc324d1485e22db7824ad784890db48eb3e48f8f Reviewed-on: https://review.openstack.org/13706 Reviewed-by: James E. Blair <corvus@inaugust.com> Reviewed-by: Clark Boylan <clark.boylan@gmail.com> Reviewed-by: Jeremy Stanley <fungi@yuggoth.org> Approved: James E. Blair <corvus@inaugust.com> Tested-by: Jenkins
Diffstat (limited to 'samples')
-rw-r--r--samples/README.md8
-rw-r--r--samples/pipeline.yaml73
2 files changed, 81 insertions, 0 deletions
diff --git a/samples/README.md b/samples/README.md
new file mode 100644
index 00000000..fce58a69
--- /dev/null
+++ b/samples/README.md
@@ -0,0 +1,8 @@
+# Jenkins Job Builder Examples #
+
+These examples demonstrate the use of particular features of Jenkins
+Job Builder that can be used as starting points for new projects.
+
+These examples are also used in the test framework - if you add a new
+example here, please ensure that it can be processed by Jenkins Job
+Builder.
diff --git a/samples/pipeline.yaml b/samples/pipeline.yaml
new file mode 100644
index 00000000..8c4da3b4
--- /dev/null
+++ b/samples/pipeline.yaml
@@ -0,0 +1,73 @@
+# Sample YAML representation of a flexible pipeline for use with the
+# Jenkins Build Pipeline Plugin
+# (https://wiki.jenkins-ci.org/display/JENKINS/Build+Pipeline+Plugin)
+# The pipeline is defined at the project level, using job-specific variable
+# substitution to specify the next job in the pipeline ('pipeline-next')
+# for each job.
+#
+# This example defines the skeleton of two deployment pipelines: one for
+# a 'base_os' subsystem to three chef servers, and the second to
+# a 'database' subsystem to two chef servers.
+#
+# The pipeline uses an automatically-executed job in '{subsys}-prepare'
+# (using the Parameterized Trigger Plugin -
+# https://wiki.jenkins-ci.org/display/JENKINS/Parameterized+Trigger+Plugin),
+# and manually-triggered jobs using the Pipeline publisher (e.g.
+# '{subsys}-initialise').
+#
+# Note how each project defines a different pipeline, with a different
+# length, but re-uses the same job templates.
+
+- project:
+ name: deploy_base_os
+ subsys: base_os
+ jobs:
+ - '{subsys}-prepare':
+ pipeline-next: '{subsys}-initialise'
+ - '{subsys}-initialise':
+ pipeline-next: '{subsys}-upload-chef-server1'
+ - '{subsys}-upload-chef-server1':
+ pipeline-next: '{subsys}-upload-chef-server2'
+ - '{subsys}-upload-chef-server2':
+ pipeline-next: '{subsys}-upload-chef-server3'
+ - '{subsys}-upload-chef-server3':
+ pipeline-next: ''
+
+- project:
+ name: deploy_database
+ subsys: db
+ jobs:
+ - '{subsys}-prepare':
+ pipeline-next: '{subsys}-initialise'
+ - '{subsys}-initialise':
+ pipeline-next: '{subsys}-upload-chef-server1'
+ - '{subsys}-upload-chef-server1':
+ pipeline-next: '{subsys}-upload-chef-server2'
+ - '{subsys}-upload-chef-server2':
+ pipeline-next: ''
+
+- job-template:
+ name: '{subsys}-prepare'
+ builders:
+ - trigger-builds:
+ - project: '{pipeline-next}'
+
+- job-template:
+ name: '{subsys}-initialise'
+ publishers:
+ - pipeline: '{pipeline-next}'
+
+- job-template:
+ name: '{subsys}-upload-chef-server1'
+ publishers:
+ - pipeline: '{pipeline-next}'
+
+- job-template:
+ name: '{subsys}-upload-chef-server2'
+ publishers:
+ - pipeline: '{pipeline-next}'
+
+- job-template:
+ name: '{subsys}-upload-chef-server3'
+ publishers:
+ - pipeline: '{pipeline-next}'