Jenkin 的 email-ext 插件的 Jelly 脚本中的无限循环。为什么?
我正在尝试使用 Jenkins 中的 email-ext 插件发送一封电子邮件,其中包含自上次成功构建以来的所有更改。我拼凑了以下内容,替换了默认 html.jelly 脚本的更改集部分,但它进入了无限循环。我不明白为什么,也不知道如何调试它。我以前从未写过 Jelly 脚本,所以这里可能有一些简单的东西。
<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 有一个 CHANGES_SINCE_LAST_SUCCESS 令牌,但我在尝试发送漂亮的 HTML 电子邮件时没有找到使其可用的方法
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我调试了一下,发现第二行到最后一行:
您需要删除scope =“parent”。并在其周围添加 ${}:
I debuged a little and found that the 2nd to the last line:
You need to remove the scope="parent". and add the ${} around it: