[OpenStack-Infra] Trouble deploying a job with a Groovy postbuild step via JJB

Wayne Warren wayne at puppet.com
Wed Jun 15 15:43:35 UTC 2016


On Wed, Jun 8, 2016 at 1:35 PM, Sebastian Schuberth <sschuberth at gmail.com>
wrote:

> 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?
>

No, the "plugin=" attributes are intended to be helpful metadata to let
readers of xml configuration files know what plugin was used to serialize
the configuration snippet in question. JJB never includes this metadata.

Have you watched the Jenkins master log file while attempting to upload the
JJB-generated configuration? Oftentimes there are helpful log messages or
stack traces that can point to the problem. As for me looking at the
configuration snippets you've included, I can't see any difference that
would be significant.


>
> --
> Sebastian Schuberth
>
> _______________________________________________
> OpenStack-Infra mailing list
> OpenStack-Infra at lists.openstack.org
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-infra
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack-infra/attachments/20160615/c1a01e91/attachment.html>


More information about the OpenStack-Infra mailing list