Merge "Wrapper pre-scm-buildstep: added support for failOnError parameter"
This commit is contained in:
commit
4f77324fea
@ -1402,33 +1402,34 @@ def pre_scm_buildstep(registry, xml_parent, data):
|
||||
Execute a Build Step before running the SCM
|
||||
Requires the Jenkins :jenkins-wiki:`pre-scm-buildstep <pre-scm-buildstep>`.
|
||||
|
||||
:arg string failOnError: Specifies if the job should fail on error
|
||||
(plugin >= 0.3) (default false).
|
||||
:arg list buildsteps: List of build steps to execute
|
||||
|
||||
:Buildstep: Any acceptable builder, as seen in the example
|
||||
|
||||
Example::
|
||||
Example:
|
||||
|
||||
wrappers:
|
||||
- pre-scm-buildstep:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
echo "Doing somethiung cool"
|
||||
- shell: |
|
||||
#!/bin/zsh
|
||||
echo "Doing somethin cool with zsh"
|
||||
- ant: "target1 target2"
|
||||
ant-name: "Standard Ant"
|
||||
- inject:
|
||||
properties-file: example.prop
|
||||
properties-content: EXAMPLE=foo-bar
|
||||
.. literalinclude::
|
||||
/../../tests/wrappers/fixtures/pre-scm-buildstep001.yaml
|
||||
:language: yaml
|
||||
"""
|
||||
# Get plugin information to maintain backwards compatibility
|
||||
info = registry.get_plugin_info('preSCMbuildstep')
|
||||
version = pkg_resources.parse_version(info.get('version', "0"))
|
||||
|
||||
bsp = XML.SubElement(xml_parent,
|
||||
'org.jenkinsci.plugins.preSCMbuildstep.'
|
||||
'PreSCMBuildStepsWrapper')
|
||||
bs = XML.SubElement(bsp, 'buildSteps')
|
||||
for step in data:
|
||||
stepList = data if type(data) is list else data.get('buildsteps')
|
||||
|
||||
for step in stepList:
|
||||
for edited_node in create_builders(registry, step):
|
||||
bs.append(edited_node)
|
||||
if version >= pkg_resources.parse_version("0.3"):
|
||||
XML.SubElement(bsp, 'failOnError').text = str(data.get(
|
||||
'failOnError', False)).lower()
|
||||
|
||||
|
||||
def logstash(registry, xml_parent, data):
|
||||
|
@ -2,9 +2,10 @@
|
||||
name: unicode-wrapper
|
||||
wrappers:
|
||||
- pre-scm-buildstep:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
echo "Unicode! ☃"
|
||||
buildsteps:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
echo "Unicode! ☃"
|
||||
|
||||
- job:
|
||||
name: test-unicode-wrapper
|
||||
|
@ -19,26 +19,28 @@
|
||||
"name": "pre-scm-shell-ant",
|
||||
"wrappers": [
|
||||
{
|
||||
"pre-scm-buildstep": [
|
||||
{
|
||||
"shell": "#!/bin/bash\necho \"Doing somethiung cool\"\n"
|
||||
},
|
||||
{
|
||||
"shell": "#!/bin/zsh\necho \"Doing somethin cool with zsh\"\n"
|
||||
},
|
||||
{
|
||||
"ant": {
|
||||
"targets": "target1 target2",
|
||||
"ant-name": "Standard Ant"
|
||||
"pre-scm-buildstep": {
|
||||
"buildsteps": [
|
||||
{
|
||||
"shell": "#!/bin/bash\necho \"Doing somethiung cool\"\n"
|
||||
},
|
||||
{
|
||||
"shell": "#!/bin/zsh\necho \"Doing somethin cool with zsh\"\n"
|
||||
},
|
||||
{
|
||||
"ant": {
|
||||
"targets": "target1 target2",
|
||||
"ant-name": "Standard Ant"
|
||||
}
|
||||
},
|
||||
{
|
||||
"inject": {
|
||||
"properties-file": "example.prop",
|
||||
"properties-content": "EXAMPLE=foo-bar"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"inject": {
|
||||
"properties-file": "example.prop",
|
||||
"properties-content": "EXAMPLE=foo-bar"
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -165,4 +167,4 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
]
|
||||
|
@ -0,0 +1,3 @@
|
||||
- longName: 'Pre SCM BuildStep Plugin'
|
||||
shortName: 'preSCMbuildstep'
|
||||
version: "0.3"
|
30
tests/wrappers/fixtures/pre-scm-buildstep001.xml
Normal file
30
tests/wrappers/fixtures/pre-scm-buildstep001.xml
Normal file
@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<buildWrappers>
|
||||
<org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper>
|
||||
<buildSteps>
|
||||
<hudson.tasks.Shell>
|
||||
<command>#!/bin/bash
|
||||
echo "Doing something cool"
|
||||
</command>
|
||||
</hudson.tasks.Shell>
|
||||
<hudson.tasks.Shell>
|
||||
<command>#!/bin/zsh
|
||||
echo "Doing something cool with zsh"
|
||||
</command>
|
||||
</hudson.tasks.Shell>
|
||||
<hudson.tasks.Ant>
|
||||
<targets>target1 target2</targets>
|
||||
<antName>default</antName>
|
||||
</hudson.tasks.Ant>
|
||||
<EnvInjectBuilder>
|
||||
<info>
|
||||
<propertiesFilePath>example.prop</propertiesFilePath>
|
||||
<propertiesContent>EXAMPLE=foo-bar</propertiesContent>
|
||||
</info>
|
||||
</EnvInjectBuilder>
|
||||
</buildSteps>
|
||||
<failOnError>true</failOnError>
|
||||
</org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper>
|
||||
</buildWrappers>
|
||||
</project>
|
15
tests/wrappers/fixtures/pre-scm-buildstep001.yaml
Normal file
15
tests/wrappers/fixtures/pre-scm-buildstep001.yaml
Normal file
@ -0,0 +1,15 @@
|
||||
wrappers:
|
||||
- pre-scm-buildstep:
|
||||
failOnError: true
|
||||
buildsteps:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
echo "Doing something cool"
|
||||
- shell: |
|
||||
#!/bin/zsh
|
||||
echo "Doing something cool with zsh"
|
||||
- ant: "target1 target2"
|
||||
ant-name: "Standard Ant"
|
||||
- inject:
|
||||
properties-file: example.prop
|
||||
properties-content: EXAMPLE=foo-bar
|
@ -0,0 +1,3 @@
|
||||
- longName: 'Pre SCM BuildStep Plugin'
|
||||
shortName: 'preSCMbuildstep'
|
||||
version: "0.2"
|
19
tests/wrappers/fixtures/pre-scm-buildstep002.xml
Normal file
19
tests/wrappers/fixtures/pre-scm-buildstep002.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<project>
|
||||
<buildWrappers>
|
||||
<org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper>
|
||||
<buildSteps>
|
||||
<hudson.tasks.Shell>
|
||||
<command>#!/bin/bash
|
||||
echo "Doing something cool"
|
||||
</command>
|
||||
</hudson.tasks.Shell>
|
||||
<hudson.tasks.Shell>
|
||||
<command>#!/bin/zsh
|
||||
echo "Doing something cool with zsh"
|
||||
</command>
|
||||
</hudson.tasks.Shell>
|
||||
</buildSteps>
|
||||
</org.jenkinsci.plugins.preSCMbuildstep.PreSCMBuildStepsWrapper>
|
||||
</buildWrappers>
|
||||
</project>
|
8
tests/wrappers/fixtures/pre-scm-buildstep002.yaml
Normal file
8
tests/wrappers/fixtures/pre-scm-buildstep002.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
wrappers:
|
||||
- pre-scm-buildstep:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
echo "Doing something cool"
|
||||
- shell: |
|
||||
#!/bin/zsh
|
||||
echo "Doing something cool with zsh"
|
@ -11,18 +11,19 @@
|
||||
name: pre-scm-shell-ant
|
||||
wrappers:
|
||||
- pre-scm-buildstep:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
echo "Doing somethiung cool"
|
||||
- shell: |
|
||||
#!/bin/zsh
|
||||
echo "Doing somethin cool with zsh"
|
||||
- ant:
|
||||
targets: "target1 target2"
|
||||
ant-name: "Standard Ant"
|
||||
- inject:
|
||||
properties-file: example.prop
|
||||
properties-content: EXAMPLE=foo-bar
|
||||
buildsteps:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
echo "Doing somethiung cool"
|
||||
- shell: |
|
||||
#!/bin/zsh
|
||||
echo "Doing somethin cool with zsh"
|
||||
- ant:
|
||||
targets: "target1 target2"
|
||||
ant-name: "Standard Ant"
|
||||
- inject:
|
||||
properties-file: example.prop
|
||||
properties-content: EXAMPLE=foo-bar
|
||||
|
||||
- wrapper:
|
||||
name: copy-files
|
||||
@ -104,4 +105,3 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
print("Doing something cool with python")
|
||||
|
||||
|
@ -12,16 +12,17 @@
|
||||
name: pre-scm-shell-ant
|
||||
wrappers:
|
||||
- pre-scm-buildstep:
|
||||
- shell:
|
||||
!include-raw: include-raw002-cool.sh
|
||||
- shell:
|
||||
!include-raw: include-raw002-cool.zsh
|
||||
- ant:
|
||||
targets: "target1 target2"
|
||||
ant-name: "Standard Ant"
|
||||
- inject:
|
||||
properties-file: example.prop
|
||||
properties-content: EXAMPLE=foo-bar
|
||||
buildsteps:
|
||||
- shell:
|
||||
!include-raw: include-raw002-cool.sh
|
||||
- shell:
|
||||
!include-raw: include-raw002-cool.zsh
|
||||
- ant:
|
||||
targets: "target1 target2"
|
||||
ant-name: "Standard Ant"
|
||||
- inject:
|
||||
properties-file: example.prop
|
||||
properties-content: EXAMPLE=foo-bar
|
||||
|
||||
- wrapper:
|
||||
name: copy-files
|
||||
@ -42,4 +43,3 @@
|
||||
- inject:
|
||||
keep-build-variables: true
|
||||
keep-system-variables: true
|
||||
|
||||
|
@ -2,8 +2,9 @@
|
||||
name: unicode-raw-include-wrapper
|
||||
wrappers:
|
||||
- pre-scm-buildstep:
|
||||
- shell:
|
||||
!include-raw: include-rawunicode001-cool.sh
|
||||
buildsteps:
|
||||
- shell:
|
||||
!include-raw: include-rawunicode001-cool.sh
|
||||
|
||||
- job:
|
||||
name: test-unicode-raw-include-wrapper
|
||||
|
@ -12,17 +12,18 @@
|
||||
name: pre-scm-shell-ant
|
||||
wrappers:
|
||||
- pre-scm-buildstep:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
echo "Doing somethiung cool"
|
||||
- shell: |
|
||||
#!/bin/zsh
|
||||
echo "Doing somethin cool with zsh"
|
||||
- ant: "target1 target2"
|
||||
ant-name: "Standard Ant"
|
||||
- inject:
|
||||
properties-file: example.prop
|
||||
properties-content: EXAMPLE=foo-bar
|
||||
buildsteps:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
echo "Doing somethiung cool"
|
||||
- shell: |
|
||||
#!/bin/zsh
|
||||
echo "Doing somethin cool with zsh"
|
||||
- ant: "target1 target2"
|
||||
ant-name: "Standard Ant"
|
||||
- inject:
|
||||
properties-file: example.prop
|
||||
properties-content: EXAMPLE=foo-bar
|
||||
|
||||
- wrapper:
|
||||
name: copy-files
|
||||
@ -43,4 +44,3 @@
|
||||
- inject:
|
||||
keep-build-variables: true
|
||||
keep-system-variables: true
|
||||
|
||||
|
@ -2,9 +2,10 @@
|
||||
name: unicode-wrapper
|
||||
wrappers:
|
||||
- pre-scm-buildstep:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
echo "Unicode! ☃"
|
||||
buildsteps:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
echo "Unicode! ☃"
|
||||
|
||||
- job:
|
||||
name: test-unicode-wrapper
|
||||
|
Loading…
Reference in New Issue
Block a user