<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 8, 2016 at 1:35 PM, Sebastian Schuberth <span dir="ltr"><<a href="mailto:sschuberth@gmail.com" target="_blank">sschuberth@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
using JJB 1.5.0 and Jenkins 2.5 I cannot get Groovy postbuild steps to<br>
work. My YAML file has:<br>
<br>
- job:<br>
    # ...<br>
    publishers:<br>
        - groovy-postbuild: |<br>
            def summary = manager.createSummary('completed.gif')<br>
            def results = new File(manager.build.workspace.remote,<br>
'results.txt').text<br>
            results = results.replace("\n", '<br/>')<br>
            results = results.replace('false', '<font color="red">false</font>')<br>
            results = results.replace('true', '<font color="green">true</font>')<br>
            summary.appendText(results, false)<br>
<br>
Calling "jenkins-jobs test" seems to correctly generate XML which has:<br>
<br>
  <publishers><br>
    <org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder><br>
      <behavior>0</behavior><br>
      <runForMatrixParent>false</runForMatrixParent><br>
      <script><br>
        <script>def summary = manager.createSummary('completed.gif')<br>
def results = new File(manager.build.workspace.remote, 'results.txt').text<br>
results = results.replace("\n", '&lt;br/&gt;')<br>
results = results.replace('false', '&lt;font color="red"&gt;false&lt;/font&gt;')<br>
results = results.replace('true', '&lt;font color="green"&gt;true&lt;/font&gt;')<br>
summary.appendText(results, false)<br>
</script><br>
        <sandbox>false</sandbox><br>
      </script><br>
    </org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder><br>
  </publishers><br>
<br>
However, when updating the job in Jenkins, I first can see the<br>
expected XML (by appending "/config.xml" to the job URL), but if I<br>
once visit the job configuration web UI, the whole section gets<br>
stripped and replaced with<br>
<br>
<publishers/><br>
<br>
So I compared the XML to a job that I created manually via the<br>
configuration web UI. The manual job has:<br>
<br>
  <publishers><br>
    <org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder<br>
plugin="groovy-postbuild@2.3.1"><br>
      <script plugin="script-security@1.19"><br>
        <script>def summary = manager.createSummary('completed.gif')<br>
def results = new File(manager.build.workspace.remote, 'results.txt').text<br>
results = results.replace("\n", '&lt;br/&gt;')<br>
results = results.replace('false', '&lt;font color="red"&gt;false&lt;/font&gt;')<br>
results = results.replace('true', '&lt;font color="green"&gt;true&lt;/font&gt;')<br>
summary.appendText(results, false)</script><br>
        <sandbox>false</sandbox><br>
      </script><br>
      <behavior>0</behavior><br>
      <runForMatrixParent>false</runForMatrixParent><br>
    </org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder><br>
  </publishers><br>
<br>
Basically, the only difference is the "plugin=" attributes. Can this<br>
be the reason why it's not working? Any other ideas?<br></blockquote><div><br></div><div>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.<br><br></div><div>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.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Sebastian Schuberth<br>
<br>
_______________________________________________<br>
OpenStack-Infra mailing list<br>
<a href="mailto:OpenStack-Infra@lists.openstack.org">OpenStack-Infra@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-infra" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-infra</a><br>
</font></span></blockquote></div><br></div></div>