我正在尝试在jenkins上实现一个阶段,以便在jenkins上发生故障时发送电子邮件.我做了一些类似jenkins文档的东西:
#!/usr/bin/env groovy
node {
stage ('Send Email') {
echo 'Send Email'
post {
failure {
mail to: 'aa@bb.cc',
subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
body: "Something is wrong with ${env.BUILD_URL}"
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
但我总是得到这个错误:
java.lang.NoSuchMethodError:步骤[档案,蝙蝠中没有发现这样的DSL方法 '后',构建,catchError,结账,deleteDir,目录,dockerFingerprintFrom,dockerFingerprintRun,回声,emailext,emailextrecipients,envVarsForTool,错误,FILEEXISTS,的getContext,混帐,输入,isUnix,图书馆,libraryResource,负荷,邮件,里程碑,节点,并行,的powershell,属性,publishHTML,PWD,READFILE,readTrusted,resolveScm,重试,脚本,SH,睡眠,阶段,藏匿,步骤,SVN,超时,时间戳,TM,工具,取消归档,unstash,validateDeclarativePipeline,最好推迟,withContext,withCredentials,withDockerContainer,withDockerRegistry,withDockerServer,withEnv,包裹物,WriteFile的,WS]或符号[所有,allOf,总是,蚂蚁,antFromApache,antOutcome,antTarget,任何,anyOf,apiToken,建筑,archiveArtifacts,artifactManager,authorizationMatrix,批处理文件,booleanParam,分支,buildButton,buildDiscarder,CASEINSENSITIVE,区分大小写,证书,更新日志,变更,选择,choiceParam,cleanWs,时钟,云,命令,证书,cron的,碎屑,默认视图,需求,disableConcurrentBuilds,搬运工,dockerCert,dockerfile,downloadSettings,下游,哑,envvars中,环境,表达,文件,fileParam,文件路径,指纹,frameOptions,自由泳, freeStyleJob,fromScm,fromSource,git,github,githubPush,gradle,headRegexFilter,headWildcardFilter,hyperlink,hyperlinkToModels,inheriting,inheritingGlobal,installSource,jacoco,jdk,jdkInstaller,jgit,jgitapache,jnlp,jobName,junit,label,lastDuration,lastFailure, lastGrantedAuthorities,lastStable,lastSuccess,legacy,legacySCM,list,local,location,logRotator,loggedInUsersCanDoAnything,masterBuild,maven,maven3Mojos,mavenErrors,mavenMojos,mavenWarnings,modernSCM,myView,node,nodeProperties,nonInheriting,nonStoredPasswordParam,none,not,overrideIndexTriggers, paneStatus,parameters,password,pattern,pipeline-model,pipelineTriggers,plainText,plugin,pollSCM,projectNamingStrategy,p roxy,queueItemAuthenticator,quietPeriod,remotingCLI,run,runParam,schedule,scmRetryCount,search,security,shell,skipDefaultCheckout,skipStagesAfterUnstable,slave,sourceRegexFilter,sourceWildcardFilter,sshUserPrivateKey,stackTrace,standard,status,string,stringParam,swapSpace,text,textParam, tmpSpace,toolLocation,无抵押,上游,usernameColonPassword,usernamePassword,viewsTabBar,天气,withAnt,ZFS,拉链]或全局[currentBuild,搬运工,ENV,则params,管道,SCM]
我看到其他一些帖子,但提出的建议对我不起作用