[OpenStack-Infra] Trouble deploying a job with a Groovy postbuild step via JJB
Sebastian Schuberth
sschuberth at gmail.com
Wed Jun 8 20:35:03 UTC 2016
Hi,
using JJB 1.5.0 and Jenkins 2.5 I cannot get Groovy postbuild steps to
work. My YAML file has:
- job:
# ...
publishers:
- groovy-postbuild: |
def summary = manager.createSummary('completed.gif')
def results = new File(manager.build.workspace.remote,
'results.txt').text
results = results.replace("\n", '<br/>')
results = results.replace('false', '<font color="red">false</font>')
results = results.replace('true', '<font color="green">true</font>')
summary.appendText(results, false)
Calling "jenkins-jobs test" seems to correctly generate XML which has:
<publishers>
<org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder>
<behavior>0</behavior>
<runForMatrixParent>false</runForMatrixParent>
<script>
<script>def summary = manager.createSummary('completed.gif')
def results = new File(manager.build.workspace.remote, 'results.txt').text
results = results.replace("\n", '<br/>')
results = results.replace('false', '<font color="red">false</font>')
results = results.replace('true', '<font color="green">true</font>')
summary.appendText(results, false)
</script>
<sandbox>false</sandbox>
</script>
</org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder>
</publishers>
However, when updating the job in Jenkins, I first can see the
expected XML (by appending "/config.xml" to the job URL), but if I
once visit the job configuration web UI, the whole section gets
stripped and replaced with
<publishers/>
So I compared the XML to a job that I created manually via the
configuration web UI. The manual job has:
<publishers>
<org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder
plugin="groovy-postbuild at 2.3.1">
<script plugin="script-security at 1.19">
<script>def summary = manager.createSummary('completed.gif')
def results = new File(manager.build.workspace.remote, 'results.txt').text
results = results.replace("\n", '<br/>')
results = results.replace('false', '<font color="red">false</font>')
results = results.replace('true', '<font color="green">true</font>')
summary.appendText(results, false)</script>
<sandbox>false</sandbox>
</script>
<behavior>0</behavior>
<runForMatrixParent>false</runForMatrixParent>
</org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder>
</publishers>
Basically, the only difference is the "plugin=" attributes. Can this
be the reason why it's not working? Any other ideas?
--
Sebastian Schuberth
More information about the OpenStack-Infra
mailing list