首页 > 解决方案 > 在 Jenkins 管道中使用 GroovyPostbuildSummaryAction

问题描述

如何GroovyPostbuildSummaryAction在我的 Jenkins 管道中使用?我试过了:

import org.jvnet.hudson.plugins.groovypostbuild.*;

但它不起作用:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 81: unable to resolve class GroovyPostbuildSummaryAction 
 @ line 81, column 34.
       GroovyPostbuildSummaryAction action = new GroovyPostbuildSummaryAction("star-gold.png");

我想在我的管道中使用共享库并使用以下代码段进行测试:https ://gist.github.com/hayderimran7/7a49d0fa484f7561120b4190f8f3a888#file-retro-add-badges-groovy

标签: jenkinsgroovy

解决方案


例如,不清楚您是否调用该操作

GroovyPostbuildSummaryAction action = new GroovyPostbuildSummaryAction('star-gold.png')
action.appendText('Comment line',false)
currentBuild.rawBuild.getActions().add(action)

以上对我有用(我们目前使用 GroovyPostBuild 插件 2.3.1)


推荐阅读