Add example to demonstrate flow plugin for job-template
Change-Id: I7bacce4f495989f8b37d6fc6b1bd773326e83b57
This commit is contained in:
parent
1d3af0f3ce
commit
4bddf4c6ee
@ -1,3 +1,4 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
|
# Copyright (C) 2013 eNovance SAS <licensing@enovance.com>
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -21,17 +22,20 @@ the :ref:`Job` definition.
|
|||||||
Requires the Jenkins `Build Flow Plugin.
|
Requires the Jenkins `Build Flow Plugin.
|
||||||
<https://wiki.jenkins-ci.org/display/JENKINS/Build+Flow+Plugin>`_
|
<https://wiki.jenkins-ci.org/display/JENKINS/Build+Flow+Plugin>`_
|
||||||
|
|
||||||
Example::
|
In order to use it for job-template you have to escape the curly braces by
|
||||||
|
doubling them in the DSL: { -> {{ , otherwise it will be interpreted by the
|
||||||
|
python str.format() command.
|
||||||
|
|
||||||
|
Job example:
|
||||||
|
|
||||||
|
.. literalinclude::
|
||||||
|
/../../tests/yamlparser/fixtures/project_flow_template001.yaml
|
||||||
|
|
||||||
|
Job template example:
|
||||||
|
|
||||||
|
.. literalinclude::
|
||||||
|
/../../tests/yamlparser/fixtures/project_flow_template002.yaml
|
||||||
|
|
||||||
job:
|
|
||||||
name: test_job
|
|
||||||
project-type: flow
|
|
||||||
dsl: |
|
|
||||||
build("job1")
|
|
||||||
parallel (
|
|
||||||
{ build("job2a") },
|
|
||||||
{ build("job2b") }
|
|
||||||
)
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import xml.etree.ElementTree as XML
|
import xml.etree.ElementTree as XML
|
||||||
|
20
tests/yamlparser/fixtures/project_flow_template001.xml
Normal file
20
tests/yamlparser/fixtures/project_flow_template001.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<com.cloudbees.plugins.flow.BuildFlow>
|
||||||
|
<dsl>build("job1")
|
||||||
|
parallel (
|
||||||
|
{ build("job2a") },
|
||||||
|
{ build("job2b") }
|
||||||
|
)
|
||||||
|
</dsl>
|
||||||
|
<actions/>
|
||||||
|
<description><!-- Managed by Jenkins Job Builder --></description>
|
||||||
|
<keepDependencies>false</keepDependencies>
|
||||||
|
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
||||||
|
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
||||||
|
<concurrentBuild>false</concurrentBuild>
|
||||||
|
<canRoam>true</canRoam>
|
||||||
|
<properties/>
|
||||||
|
<scm class="hudson.scm.NullSCM"/>
|
||||||
|
<publishers/>
|
||||||
|
<buildWrappers/>
|
||||||
|
</com.cloudbees.plugins.flow.BuildFlow>
|
9
tests/yamlparser/fixtures/project_flow_template001.yaml
Normal file
9
tests/yamlparser/fixtures/project_flow_template001.yaml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
- job:
|
||||||
|
name: test_job
|
||||||
|
project-type: flow
|
||||||
|
dsl: |
|
||||||
|
build("job1")
|
||||||
|
parallel (
|
||||||
|
{ build("job2a") },
|
||||||
|
{ build("job2b") }
|
||||||
|
)
|
32
tests/yamlparser/fixtures/project_flow_template002.xml
Normal file
32
tests/yamlparser/fixtures/project_flow_template002.xml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<com.cloudbees.plugins.flow.BuildFlow>
|
||||||
|
<dsl>build("job1")
|
||||||
|
parallel (
|
||||||
|
{ build("job2a") },
|
||||||
|
{ build("job2b") }
|
||||||
|
)
|
||||||
|
build("job2c")
|
||||||
|
</dsl>
|
||||||
|
<actions/>
|
||||||
|
<description><!-- Managed by Jenkins Job Builder --></description>
|
||||||
|
<keepDependencies>false</keepDependencies>
|
||||||
|
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
|
||||||
|
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
|
||||||
|
<concurrentBuild>false</concurrentBuild>
|
||||||
|
<canRoam>true</canRoam>
|
||||||
|
<properties/>
|
||||||
|
<scm class="hudson.scm.NullSCM"/>
|
||||||
|
<builders>
|
||||||
|
<hudson.tasks.Shell>
|
||||||
|
<command>unittest</command>
|
||||||
|
</hudson.tasks.Shell>
|
||||||
|
</builders>
|
||||||
|
<publishers>
|
||||||
|
<hudson.tasks.Mailer>
|
||||||
|
<recipients>developer@nowhere.net</recipients>
|
||||||
|
<dontNotifyEveryUnstableBuild>false</dontNotifyEveryUnstableBuild>
|
||||||
|
<sendToIndividuals>false</sendToIndividuals>
|
||||||
|
</hudson.tasks.Mailer>
|
||||||
|
</publishers>
|
||||||
|
<buildWrappers/>
|
||||||
|
</com.cloudbees.plugins.flow.BuildFlow>
|
26
tests/yamlparser/fixtures/project_flow_template002.yaml
Normal file
26
tests/yamlparser/fixtures/project_flow_template002.yaml
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
- job-template:
|
||||||
|
name: '{name}-unit-tests'
|
||||||
|
project-type: flow
|
||||||
|
dsl: |
|
||||||
|
build("job1")
|
||||||
|
parallel (
|
||||||
|
{{ build("job2a") }},
|
||||||
|
{{ build("job2b") }}
|
||||||
|
)
|
||||||
|
build("job2c")
|
||||||
|
builders:
|
||||||
|
- shell: unittest
|
||||||
|
publishers:
|
||||||
|
- email:
|
||||||
|
recipients: '{mail-to}'
|
||||||
|
|
||||||
|
- job-group:
|
||||||
|
name: '{name}-tests'
|
||||||
|
jobs:
|
||||||
|
- '{name}-unit-tests':
|
||||||
|
mail-to: developer@nowhere.net
|
||||||
|
|
||||||
|
- project:
|
||||||
|
name: project-name
|
||||||
|
jobs:
|
||||||
|
- '{name}-tests'
|
Loading…
x
Reference in New Issue
Block a user