Option to mark build as unstable in PostBuildScript publisher
Change-Id: I0c0817397e22ef585e5ba4be4b038395b6d21b3d
This commit is contained in:
parent
6b3beb965c
commit
231883819a
|
@ -2844,6 +2844,10 @@ def postbuildscript(parser, xml_parent, data):
|
||||||
:arg bool onfailure: Deprecated, replaced with script-only-if-failed
|
:arg bool onfailure: Deprecated, replaced with script-only-if-failed
|
||||||
:arg bool script-only-if-failed: Scripts and builders are run only if the
|
:arg bool script-only-if-failed: Scripts and builders are run only if the
|
||||||
build failed (default False)
|
build failed (default False)
|
||||||
|
:arg bool mark-unstable-if-failed: Build will be marked unstable
|
||||||
|
if job will be successfully completed
|
||||||
|
but publishing script will return
|
||||||
|
non zero exit code (default False)
|
||||||
:arg str execute-on: For matrix projects, scripts can be run after each
|
:arg str execute-on: For matrix projects, scripts can be run after each
|
||||||
axis is built (`axes`), after all axis of the matrix
|
axis is built (`axes`), after all axis of the matrix
|
||||||
are built (`matrix`) or after each axis AND the matrix
|
are built (`matrix`) or after each axis AND the matrix
|
||||||
|
@ -2936,6 +2940,9 @@ def postbuildscript(parser, xml_parent, data):
|
||||||
else:
|
else:
|
||||||
failure_xml.text = str(data.get('onfailure', False)).lower()
|
failure_xml.text = str(data.get('onfailure', False)).lower()
|
||||||
|
|
||||||
|
# Mark build unstable if publisher script return non zero exit code
|
||||||
|
XML.SubElement(pbs_xml, 'markBuildUnstable').text = str(
|
||||||
|
data.get('mark-unstable-if-failed', False)).lower()
|
||||||
# TODO: we may want to avoid setting "execute-on" on non-matrix jobs,
|
# TODO: we may want to avoid setting "execute-on" on non-matrix jobs,
|
||||||
# either by skipping this part or by raising an error to let the user know
|
# either by skipping this part or by raising an error to let the user know
|
||||||
# an attempt was made to set execute-on on a non-matrix job. There are
|
# an attempt was made to set execute-on on a non-matrix job. There are
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<org.jenkinsci.plugins.postbuildscript.PostBuildScript>
|
<org.jenkinsci.plugins.postbuildscript.PostBuildScript>
|
||||||
<scriptOnlyIfSuccess>true</scriptOnlyIfSuccess>
|
<scriptOnlyIfSuccess>true</scriptOnlyIfSuccess>
|
||||||
<scriptOnlyIfFailure>false</scriptOnlyIfFailure>
|
<scriptOnlyIfFailure>false</scriptOnlyIfFailure>
|
||||||
|
<markBuildUnstable>false</markBuildUnstable>
|
||||||
</org.jenkinsci.plugins.postbuildscript.PostBuildScript>
|
</org.jenkinsci.plugins.postbuildscript.PostBuildScript>
|
||||||
</publishers>
|
</publishers>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
</groovyScriptContentList>
|
</groovyScriptContentList>
|
||||||
<scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
|
<scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
|
||||||
<scriptOnlyIfFailure>true</scriptOnlyIfFailure>
|
<scriptOnlyIfFailure>true</scriptOnlyIfFailure>
|
||||||
|
<markBuildUnstable>true</markBuildUnstable>
|
||||||
</org.jenkinsci.plugins.postbuildscript.PostBuildScript>
|
</org.jenkinsci.plugins.postbuildscript.PostBuildScript>
|
||||||
</publishers>
|
</publishers>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -11,3 +11,4 @@ publishers:
|
||||||
- "/** Some more inlined groovy */"
|
- "/** Some more inlined groovy */"
|
||||||
script-only-if-succeeded: False
|
script-only-if-succeeded: False
|
||||||
script-only-if-failed: True
|
script-only-if-failed: True
|
||||||
|
mark-unstable-if-failed: True
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
</buildSteps>
|
</buildSteps>
|
||||||
<scriptOnlyIfSuccess>true</scriptOnlyIfSuccess>
|
<scriptOnlyIfSuccess>true</scriptOnlyIfSuccess>
|
||||||
<scriptOnlyIfFailure>false</scriptOnlyIfFailure>
|
<scriptOnlyIfFailure>false</scriptOnlyIfFailure>
|
||||||
|
<markBuildUnstable>false</markBuildUnstable>
|
||||||
</org.jenkinsci.plugins.postbuildscript.PostBuildScript>
|
</org.jenkinsci.plugins.postbuildscript.PostBuildScript>
|
||||||
</publishers>
|
</publishers>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
</buildSteps>
|
</buildSteps>
|
||||||
<scriptOnlyIfSuccess>true</scriptOnlyIfSuccess>
|
<scriptOnlyIfSuccess>true</scriptOnlyIfSuccess>
|
||||||
<scriptOnlyIfFailure>false</scriptOnlyIfFailure>
|
<scriptOnlyIfFailure>false</scriptOnlyIfFailure>
|
||||||
|
<markBuildUnstable>false</markBuildUnstable>
|
||||||
<executeOn>MATRIX</executeOn>
|
<executeOn>MATRIX</executeOn>
|
||||||
</org.jenkinsci.plugins.postbuildscript.PostBuildScript>
|
</org.jenkinsci.plugins.postbuildscript.PostBuildScript>
|
||||||
</publishers>
|
</publishers>
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
</groovyScriptFileList>
|
</groovyScriptFileList>
|
||||||
<scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
|
<scriptOnlyIfSuccess>false</scriptOnlyIfSuccess>
|
||||||
<scriptOnlyIfFailure>true</scriptOnlyIfFailure>
|
<scriptOnlyIfFailure>true</scriptOnlyIfFailure>
|
||||||
|
<markBuildUnstable>true</markBuildUnstable>
|
||||||
</org.jenkinsci.plugins.postbuildscript.PostBuildScript>
|
</org.jenkinsci.plugins.postbuildscript.PostBuildScript>
|
||||||
</publishers>
|
</publishers>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -14,3 +14,4 @@ publishers:
|
||||||
- '/tmp/two.groovy'
|
- '/tmp/two.groovy'
|
||||||
script-only-if-succeeded: False
|
script-only-if-succeeded: False
|
||||||
script-only-if-failed: True
|
script-only-if-failed: True
|
||||||
|
mark-unstable-if-failed: True
|
||||||
|
|
Loading…
Reference in New Issue