简体   繁体   English

Jenkins 更新后出现错误:java.lang.NoSuchMethodError: No such DSL method 'pipeline' found between steps

[英]Getting error after Jenkins update: java.lang.NoSuchMethodError: No such DSL method 'pipeline' found among steps

My Jenkins pipeline is failing after I updated by Jenkins version from 2.224 to 2.234 along with all the plugins to the latest version.在我将 Jenkins 版本从 2.224 更新到 2.234 以及所有插件到最新版本后,我的 Jenkins 管道失败。

Below is my pipeline script which was working fine with older Jenkins and older plugins.下面是我的管道脚本,它可以与旧的 Jenkins 和旧的插件一起正常工作。

With Jenkins and plugin update, the pipeline is failing.随着 Jenkins 和插件更新,管道失败。

    pipeline { 
        agent none    
        stages {
             stage ("Check Parameters") { 
                   steps {
                       echo "In pipeline"
                          script {
                            echo "Start condition check"
                          }
                    }
                }
            }
    }

The above is just a sample as the actual pipeline script is quite vast and I did not wish to confuse the readers.以上只是一个示例,因为实际的管道脚本非常庞大,我不想让读者感到困惑。

I get the following Error when i run the pipeline运行管道时出现以下错误

    [Pipeline] Start of Pipeline
    [Pipeline] End of Pipeline
    java.lang.NoSuchMethodError: No such DSL method 'pipeline' found among steps [ansiColor, ansiblePlaybook, ansibleTower, ansibleTowerProjectRevision, ansibleTowerProjectSync, ansibleVault, archive, bat, catchError, checkout, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, dockerNode, echo, emailext, emailextrecipients, error, fileExists, findBuildScans, getContext, git, input, isUnix, junit, library, libraryResource, load, lock, mail, node, parallel, powershell, properties, publishHTML, pwd, pwsh, readFile, readTrusted, resolveScm, retry, sh, sleep, stage, stash, step, svn, task, timeout, tm, tool, unarchive, unstable, unstash, waitUntil, warnError, withContext, withCredentials, withDockerContainer, withDockerRegistry, withDockerServer, withEnv, withGradle, wrap, writeFile, ws] or symbols [all, always, ant, antFromApache, antOutcome, antTarget, apiToken, architecture, archiveArtifacts, artifactManager, attach, authorizationMatrix, batchFile, booleanParam, brokenBuildSuspects, brokenTestsSuspects, buildButton, buildDiscarder, buildDiscarders, buildFailureAnalyzer, caseInsensitive, caseSensitive, certificate, choice, choiceParam, cleanWs, clock, command, credentials, cron, crumb, cssText, cssUrl, culprits, defaultFolderConfiguration, defaultView, demand, developers, disableConcurrentBuilds, disableResume, docker, dockerCert, dockerfile, downstream, dumb, durabilityHint, envInject, envVars, faviconUrl, file, fileParam, filePath, fingerprint, frameOptions, freeStyle, freeStyleJob, fromScm, fromSource, ftpPublisher, git, gitBranchDiscovery, gitHubBranchDiscovery, gitHubBranchHeadAuthority, gitHubExcludeArchivedRepositories, gitHubForkDiscovery, gitHubPullRequestDiscovery, gitHubSshCheckout, gitHubTagDiscovery, gitHubTrustContributors, gitHubTrustEveryone, gitHubTrustNobody, gitHubTrustPermissions, gitParameter, gitTagDiscovery, github, githubPush, gradle, headRegexFilter, headWildcardFilter, hyperlink, hyperlinkToModels, inheriting, inheritingGlobal, installSource, jdk, jdkInstaller, jgit, jgitapache, jnlp, jobBuildDiscarder, jobName, jsUrl, lastDuration, lastFailure, lastGrantedAuthorities, lastStable, lastSuccess, legacy, legacySCM, list, local, location, logRotator, loggedInUsersCanDoAnything, mailer, masterBuild, maven, maven3Mojos, mavenErrors, mavenMojos, mavenWarnings, modernSCM, myView, newContainerPerStage, nodeProperties, nonInheriting, none, overrideIndexTriggers, paneStatus, parameterizedCron, parameters, password, pattern, permanent, pipeline-model, pipeline-model-docker, pipelineTriggers, plainText, plugin, pollSCM, projectNamingStrategy, proxy, queueItemAuthenticator, quietPeriod, rateLimitBuilds, recipients, requestor, resourceRoot, run, runParam, sSHLauncher, schedule, scmRetryCount, scriptApproval, scriptApprovalLink, search, security, shell, simple-theme-plugin, simpleBuildDiscarder, slave, sourceRegexFilter, sourceWildcardFilter, ssh, sshPublicKey, sshPublisher, sshPublisherDesc, sshTransfer, sshUserPrivateKey, standard, status, string, stringParam, swapSpace, teamSlugFilter, text, textParam, timezone, tmpSpace, toolLocation, unsecured, upstream, upstreamDevelopers, userSeed, usernameColonPassword, usernamePassword, validatingString, viewsTabBar, weather, withAnt, zfs, zip] or globals [currentBuild, docker, env, params, scm]
        at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:202)
        at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
        at sun.reflect.GeneratedMethodAccessor232.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
        at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
        at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:163)
        at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
        at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:157)
        at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:142)
        at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:161)
        at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:165)
        at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
        at WorkflowScript.run(WorkflowScript:1)
        at ___cps.transform___(Native Method)
        at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:86)
        at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:113)
        at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:83)
        at sun.reflect.GeneratedMethodAccessor231.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
        at com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:46)
        at com.cloudbees.groovy.cps.Next.step(Next.java:83)
        at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174)
        at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163)
        at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:129)
        at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:268)
        at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163)
        at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
        at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:51)
        at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:185)
        at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:400)
        at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96)
        at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:312)
        at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:276)
        at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
        at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
        at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
    Finished: FAILURE

The current updated latest versions of pipeline plugin showing under Installed tab of Plugin Manager is below: The one thing that I see missing that was visible earlier under installed plugins is Pipeline: version 2.6Plugin ManagerInstalled选项卡下显示的当前更新的管道插件最新版本如下:我看到的缺失的一件事是在已安装插件下可见的早期版本是管道:2.6 版

Upon my research I downloaded https://plugins.jenkins.io/workflow-aggregator/ hpi file, however, when i install this plugin in offline mode it tried to pull dependencies like Pipeline Milestone Step etc.根据我的研究,我下载了 https://plugins.jenkins.io/workflow-aggregator/ hpi 文件,但是,当我在离线模式下安装此插件时,它试图提取诸如Pipeline Milestone Step等依赖项。

Is getting this hpi file and its dependencies installed the solution to my problem?获取此 hpi 文件及其依赖项是否安装了我的问题的解决方案? Please clarify.请说清楚。

    Build Pipeline Plugin
    This plugin renders upstream and downstream connected jobs that typically form a build pipeline. In addition, it offers the ability to define manual triggers for jobs that require intervention prior to execution, e.g. an approval process outside of Jenkins.
    1.5.8       
        
    Delivery Pipeline Plugin
    This plugin visualize Delivery Pipelines (Jobs with upstream/downstream dependencies)
    1.4.2       
            
    Pipeline Graph Analysis Plugin
    Provides a REST API to access pipeline and pipeline run data.
    1.10        
        
    Pipeline: API
    Plugin that defines Pipeline API.
    2.40        
        
    Pipeline: Basic Steps
    Commonly used steps for Pipelines.
    2.20    
        
    Pipeline: Declarative Extension Points API
    APIs for extension points used in Declarative Pipelines.
    1.6.0       
        
    Pipeline: GitHub Groovy Libraries
    Allows Pipeline Grrovy libraries to be loaded on the fly from GitHub.
    1.0     
        
    Pipeline: Groovy
    Pipeline execution engine based on continuation passing style transformation of Groovy scripts.
    2.80        
        
    Pipeline: Input Step
    Adds the Pipeline step input to wait for human input or approval.
    2.11        
        
    Pipeline: Job
    Defines a new job type for pipelines and provides their generic user interface.
    2.39    
        
    Pipeline: Model API
    Model API for Declarative Pipeline.
    1.6.0       
        
    Pipeline: Multibranch
    Enhances Pipeline plugin to handle branches better by automatically grouping builds from different branches.
    2.21        
        
    Pipeline: Nodes and Processes
    Pipeline steps locking agents and workspaces, and running external processes that may survive a Jenkins restart or slave reconnection.
    2.35        
        
    Pipeline: REST API Plugin
    Provides a REST API to access pipeline and pipeline run data.
    2.13        
        
    Pipeline: SCM Step
    Adds a Pipeline step to check out or update working sources from various SCMs (version control).
    2.11    
        
    Pipeline: Shared Groovy Libraries
    Shared libraries for Pipeline scripts.
    2.16    
        
    Pipeline: Stage Step
    Adds the Pipeline step stage to delineate portions of a build.
    2.3     
        
    Pipeline: Stage View Plugin
    Pipeline Stage View Plugin.
    2.13        
        
    Pipeline: Step API
    API for asynchronous build step primitive.
    2.22        
        
    Pipeline: Supporting APIs
    Common utility implementations to build Pipeline Plugin
    3.4     

I do not have internet connectivity and I have to copy the plugins manually.我没有互联网连接,我必须手动复制插件。

I do see the downgrade button next to a few plugins.我确实看到了一些插件旁边的降级按钮。 However, do not wish to downgrade due to vulnerability and bug fixes.但是,不希望由于漏洞和错误修复而降级。

Can you please suggest some solution, please?你能建议一些解决方案吗?

The issue was pipeline plugin was not installed.问题是未安装管道插件。 Thus I downloaded the pipeline plugin version 2.6因此我下载了管道插件版本 2.6

https://plugins.jenkins.io/workflow-aggregator/ https://plugins.jenkins.io/workflow-aggregator/

I then downloaded the dependencies as below:然后我下载了如下依赖项:

https://www.jenkins.io/doc/pipeline/steps/pipeline-build-step/
https://updates.jenkins.io/download/plugins/pipeline-milestone-step/
https://plugins.jenkins.io/pipeline-model-definition/
https://plugins.jenkins.io/pipeline-model-declarative-agent/
https://plugins.jenkins.io/pipeline-stage-tags-metadata/ 

Installed them one by one in offline mode and the issue was resolved.在离线模式下一一安装,问题已解决。

In my case the Ansible plugin was installed, but there were some security issues which was causing the issue.在我的情况下,安装了 Ansible 插件,但存在一些导致问题的安全问题。 I updated the Ansible plugin, restarted the Jenkins, executed the pipeline job and it worked.我更新了 Ansible 插件,重新启动了 Jenkins,执行了管道作业并且它工作了。

If you have plugin installed, please check in Manage Jenkins section that is there any security warning which needs resolution.如果您安装了插件,请检查Manage Jenkins部分是否有任何需要解决的安全警告。

You need to check is Ansible enabled.您需要检查 Ansible 是否启用。

  • Navigate to Manage Jenkins -> Manage Plugins -> Installed and check " Ansible Plugin " is enabled .导航到Manage Jenkins -> Manage Plugins -> Installed并检查“ Ansible 插件”是否已启用
  • If it's not, then enable it and press the restart button at the bottom.如果不是,则启用它并按底部的重新启动按钮。

Last step is to Configure Ansible最后一步是配置Ansible

  • Go to Manage Jenkins -> Global tool configuration Go Manage Jenkins -> Global tool configuration
  • Scroll down and go to Ansible section and click " Ansible installations... "向下滚动 go 到Ansible部分,然后单击“ Ansible 安装...
  • In Name field, set any name you want名称字段中,设置您想要的任何名称
  • In Path to Ansible executables directory set "/usr/bin/" (For Ubuntu)Ansible 可执行文件目录的路径中设置“/usr/bin/”(对于 Ubuntu)

To get the path of Ansible installation use $ which ansible in terminal要获取 Ansible 安装的路径,请在终端中使用$ which ansible

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 詹金斯:java.lang.NoSuchMethodError:在步骤中找不到这样的DSL方法'$' - Jenkins : java.lang.NoSuchMethodError: No such DSL method '$' found among steps java.lang.NoSuchMethodError:在步骤之间找不到这样的DSL方法“ pollScm”(Jenkins脚本化管道) - java.lang.NoSuchMethodError: No such DSL method 'pollScm' found among steps (Jenkins scripted pipeline) 错误java.lang.NoSuchMethodError:在步骤之间找不到这样的DSL方法“ ***” - Error java.lang.NoSuchMethodError: No such DSL method '***' found among steps java.lang.NoSuchMethodError:在步骤中找不到这样的DSL方法'echo' - java.lang.NoSuchMethodError: No such DSL method 'echo' found among steps java.lang.NoSuchMethodError:步骤之间未找到这种DSL方法 - java.lang.NoSuchMethodError: No such DSL method found among steps java.lang.NoSuchMethodError:在步骤中找不到此类 DSL 方法“阶段” - java.lang.NoSuchMethodError: No such DSL method 'stages' found among steps java.lang.NoSuchMethodError:在步骤中找不到这样的DSL方法'bash' - java.lang.NoSuchMethodError: No such DSL method 'bash' found among steps java.lang.NoSuchMethodError:在步骤中找不到这样的 DSL 方法“sshagent”? - java.lang.NoSuchMethodError: No such DSL method 'sshagent' found among steps? java.lang.NoSuchMethodError: 在步骤中找不到这样的 DSL 方法“$” - java.lang.NoSuchMethodError: No such DSL method '$' found among steps java.lang.NoSuchMethodError: 在使用 jenkins 共享库时,在步骤中找不到这样的 DSL 方法“ci” - java.lang.NoSuchMethodError: No such DSL method 'ci' found among steps when using jenkins shared library
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM