开发者

Infinite loop in Jelly script for Jenkin's email-ext plugin. Why? [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 11 years ago.

I'm trying to use the email-ext plugin in Jenkins to send an email containing all of the changes since the last successful build. I've pieced together the following, replacing the change set portion of the default html.jelly script, but it goes into an infinite loop. I don't see why, and I'm not sure how I'd debug it. I have never written a Jelly script before, so there is probably something simple in here.

<j:set var="changesBuild" value="${build.previousNotFailedBuild}" />
<j:if test="${changesBuild!=null}">
  <j:set var="changesBuild" value="changesBuild.nextBuild" scope="parent" />
</j:if>
<j:if test="${changesBuild==null}">
  <j:set var="changesBuild" value="build" scope="parent"  />
</j:if>

<j:while test="${changesBuild!=null}">
  <j:set var="changeSet" value="${changesBuild.changeSet}" />
  <j:if test="${changeSet!=null}">
  <j:set var="hadChanges" value="false" />
    <TABLE width="100%">
    <TR><TD class="bg1" colspan="2"><B>CHANGES</B></TD></TR>
    <j:forEach var="cs" items="${changeSet}" varStatus="loop">
      <j:set var="hadChanges" value="true" />
      <j:set var="aUser" value="${cs.hudsonUser}"/>
      <TR>
        <TD colspan="2" class="bg2">${spc}Revision <B>${cs.commitId?:cs.revision?:cs.changeNumber}</B> by
          <B>${aUser!=null?aUser.displayName:cs.author.displayName}: </B>
          <B>(${cs.msgAnnotated})</B>
         </TD>
      </TR>
      <j:forEach var="p" items="${cs.affectedFiles}">
        <TR>
          <TD width="10%">${spc}${p.editType.name}</TD>
          <TD>${p.path}</TD>
        </TR>
      </j:forEach>
    </j:forEach>
    <j:if test="${!hadChanges}">
      <TR><TD colspan="2">No Changes</TD>开发者_开发技巧;</TR>
    </j:if>
    </TABLE>
    <BR/>
  </j:if>
  <j:set var="changesBuild" value="changesBuild.nextBuild" scope="parent" />
</j:while>

Email-ext has a CHANGES_SINCE_LAST_SUCCESS token, but I don't see a way to make that available when trying to send nice HTML emails


I debuged a little and found that the 2nd to the last line:

<j:set var="changesBuild" value="changesBuild.nextBuild" scope="parent" />

You need to remove the scope="parent". and add the ${} around it:

  <j:set var="changesBuild" value="${changesBuild.nextBuild}" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜