[英]how to resolve the issue groovy.lang.MissingMethodException: No signature of method:
I am getting an error in jenkins pipeline script. 我在jenkins管道脚本中收到错误。 The error says that groovy.lang.MissingMethodException: No signature of method: org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper.getExecutor() is applicable for argument types: () values: []
错误说groovy.lang.MissingMethodException:没有方法签名:org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper.getExecutor()适用于参数类型:()值:[]
I am trying to integrate jenkins and grafana 我想整合jenkins和grafana
stage('Grafana Results') {
// grafana url for aggregate dashboard - replace time stamp with %s
def perfResult = "<grafana url>?orgId=39&from=%s&to=%s"
// get build start and end time
def start = currentBuild.getStartTimeInMillis();
def end = start + currentBuild.getExecutor().getElapsedTime();
// replace time
perfResult = String.format(perfResult, start, end);
//build the string to be added as description.
def link = "<a href='%s'>%s</a><br/>";
def sb = new StringBuilder();
sb.append(String.format(link, perfResult, "Grafana Performance Result"));
// set build description
currentBuild.setDescription(sb.toString());
}
first - you have to read error. 首先 - 你必须阅读错误。 there is an answer in it:
有一个答案:
No signature of method:
没有方法签名:
org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper.getExecutor()
is applicable for argument types: () values: []
适用于参数类型:()值:[]
search the documentation for the class org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper
: 搜索类
org.jenkinsci.plugins.workflow.support.steps.build.RunWrapper
的文档:
https://javadoc.jenkins.io/plugin/workflow-support/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapper.html https://javadoc.jenkins.io/plugin/workflow-support/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapper.html
and in this class there is no method getExecutor()
. 在这个类中没有
getExecutor()
方法。
however there is a getRawBuild()
method that returns https://javadoc.jenkins.io/hudson/model/Run.html 但是有一个
getRawBuild()
方法返回https://javadoc.jenkins.io/hudson/model/Run.html
so, probably this will work for you: 所以,这可能适合你:
currentBuild.getRawBuild().getExecutor().getElapsedTime()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.