[JIRA] (JENKINS-38968) groovy-html.template: use of member changeSet instead of changeSets

11 views
Skip to first unread message

heiko.nardmann@itechnical.de (JIRA)

unread,
Oct 13, 2016, 12:53:05 PM10/13/16
to jenkinsc...@googlegroups.com
Heiko Nardmann created an issue
 
Jenkins / Bug JENKINS-38968
groovy-html.template: use of member changeSet instead of changeSets
Issue Type: Bug Bug
Assignee: David van Laatum
Components: email-ext-plugin
Created: 2016/Oct/13 4:52 PM
Priority: Minor Minor
Reporter: Heiko Nardmann

While using groovy-html.template inside a pipeline DSL I get the following stack trace sent via eMail:

Exception raised during template rendering:
No such property: changeSet for class: org.jenkinsci.plugins.workflow.job.WorkflowRun
Possible solutions: changeSets
groovy.lang.MissingPropertyException: No such property: changeSet for class: org.jenkinsci.plugins.workflow.job.WorkflowRun
Possible solutions: changeSets
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:53)
at org.codehaus.groovy.runtime.callsite.GetEffectivePojoPropertySite.getProperty(GetEffectivePojoPropertySite.java:66)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callGetProperty(AbstractCallSite.java:296)
at SimpleTemplateScript1.run(SimpleTemplateScript1.groovy:33)
at groovy.text.SimpleTemplateEngine$SimpleTemplate$1.writeTo(SimpleTemplateEngine.java:168)
at groovy.text.SimpleTemplateEngine$SimpleTemplate$1.toString(SimpleTemplateEngine.java:180)
at hudson.plugins.emailext.plugins.content.ScriptContent.renderTemplate(ScriptContent.java:127)
at hudson.plugins.emailext.plugins.content.ScriptContent.evaluate(ScriptContent.java:68)
at org.jenkinsci.plugins.tokenmacro.DataBoundTokenMacro.evaluate(DataBoundTokenMacro.java:205)
at org.jenkinsci.plugins.tokenmacro.Parser.processToken(Parser.java:299) at org.jenkinsci.plugins.tokenmacro.Action$KiHW1UeqOdqAwZul.run(Unknown Source) at org.parboiled.matchers.ActionMatcher.match(ActionMatcher.java:96) at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77) at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351) at org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46) at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77) at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351) at org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41) at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77) at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351) at org.parboiled.matchers.FirstOfMatcher.match(FirstOfMatcher.java:41) at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77) at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351) at org.parboiled.matchers.ZeroOrMoreMatcher.match(ZeroOrMoreMatcher.java:39) at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77) at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351) at org.parboiled.matchers.SequenceMatcher.match(SequenceMatcher.java:46) at org.parboiled.parserunners.BasicParseRunner.match(BasicParseRunner.java:77) at org.parboiled.MatcherContext.runMatcher(MatcherContext.java:351) at org.parboiled.parserunners.BasicParseRunner.run(BasicParseRunner.java:72) at org.parboiled.parserunners.ReportingParseRunner.runBasicMatch(ReportingParseRunner.java:86) at org.parboiled.parserunners.ReportingParseRunner.run(ReportingParseRunner.java:66) at org.parboiled.parserunners.AbstractParseRunner.run(AbstractParseRunner.java:81) at org.parboiled.parserunners.AbstractParseRunner.run(AbstractParseRunner.java:76) at org.jenkinsci.plugins.tokenmacro.Parser.process(Parser.java:68) at org.jenkinsci.plugins.tokenmacro.TokenMacro.expand(TokenMacro.java:204) at org.jenkinsci.plugins.tokenmacro.TokenMacro.expandAll(TokenMacro.java:234) at hudson.plugins.emailext.plugins.ContentBuilder.transformText(ContentBuilder.java:80) at hudson.plugins.emailext.ExtendedEmailPublisher.addContent(ExtendedEmailPublisher.java:718) at hudson.plugins.emailext.ExtendedEmailPublisher.createMail(ExtendedEmailPublisher.java:597) at hudson.plugins.emailext.ExtendedEmailPublisher.sendMail(ExtendedEmailPublisher.java:355) at hudson.plugins.emailext.EmailExtStep$EmailExtStepExecution.run(EmailExtStep.java:189) at hudson.plugins.emailext.EmailExtStep$EmailExtStepExecution.run(EmailExtStep.java:129) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1$1.call(AbstractSynchronousNonBlockingStepExecution.java:52) at hudson.security.ACL.impersonate(ACL.java:221) at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousNonBlockingStepExecution$1.run(AbstractSynchronousNonBlockingStepExecution.java:49) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) at java.util.concurrent.FutureTask.run(FutureTask.java:262) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:745) 
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

heiko.nardmann@itechnical.de (JIRA)

unread,
Oct 14, 2016, 3:09:01 AM10/14/16
to jenkinsc...@googlegroups.com
Heiko Nardmann commented on Bug JENKINS-38968
 
Re: groovy-html.template: use of member changeSet instead of changeSets

Replacing

<% def changeSet = build.changeSet

with

<% def changeSet = build.changeSets

fixes the problem.

heiko.nardmann@itechnical.de (JIRA)

unread,
Oct 18, 2016, 10:26:01 AM10/18/16
to jenkinsc...@googlegroups.com

My last comment has not been complete. My Problem has been that my tests afterwards did not enter the block inside the if statement:

if(changeSets != null) {
...

So now the whole block looks like the following on my part:

<% def changeSets = build.changeSets
if(changeSets != null) {
        def hadChanges = false %>
        <TABLE width="100%">
    <TR><TD class="bg1" colspan="2"><B>CHANGES</B></TD></TR>
<%      changeSets.each() { p4ChangeSet ->
                p4ChangeSet.each() { cs ->
                hadChanges = true %>
      <TR>
        <TD colspan="2" class="bg2">&nbsp;&nbsp;Revision <B><%= cs.metaClass.hasProperty('commitId') ? cs.commitId : cs.metaClass.hasProperty('revision') ? cs.revision :
        cs.metaClass.hasProperty('changeNumber') ? cs.changeNumber : "" %></B> by
          <B><%= cs.author %>: </B>
          <B>(${cs.msgAnnotated})</B>
         </TD>
      </TR>
<%                      cs.affectedFiles.each() { p -> %>
        <TR>
          <TD width="10%">&nbsp;&nbsp;${p.editType.name}</TD>
          <TD>${p.path}</TD>
        </TR>
<%                      }
                }
        }

I'm not sure whether this is something Perforce special or Workflow special?

slide.o.mix@gmail.com (JIRA)

unread,
Nov 7, 2016, 2:22:01 PM11/7/16
to jenkinsc...@googlegroups.com

You would need to add another layer of .each because getChangesets returns a list of ChangeLogSet (what build.getChangeset returned). So, you would need to iterate through the list outside of the changeSets.each() you have now...

changeSets.each() {
    changeSet.each() {
        p4ChangeSet.each() { cs ->
            ...
        }
    }
}

slide.o.mix@gmail.com (JIRA)

unread,
Mar 22, 2019, 10:05:04 AM3/22/19
to jenkinsc...@googlegroups.com
Alex Earl closed an issue as Fixed
 
Change By: Alex Earl
Status: Reopened Closed
Resolution: Fixed
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)
Reply all
Reply to author
Forward
0 new messages