On Wed, Jun 8, 2016 at 1:35 PM, Sebastian Schuberth <[email protected]>
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="[email protected]">
> <script plugin="[email protected]">
> <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
> [email protected]
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-infra
>
_______________________________________________
OpenStack-Infra mailing list
[email protected]
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-infra