0
votes

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.

Below is my pipeline script which was working fine with older Jenkins and older plugins.

With Jenkins and plugin update, the pipeline is failing.

    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.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.

Is getting this hpi file and its dependencies installed the solution to my problem? 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?

2

2 Answers

1
votes

The issue was pipeline plugin was not installed. Thus I downloaded the pipeline plugin version 2.6

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.

0
votes

In my case the Ansible plugin was installed, but there were some security issues which was causing the issue. I updated the Ansible plugin, restarted the Jenkins, executed the pipeline job and it worked.

If you have plugin installed, please check in Manage Jenkins section that is there any security warning which needs resolution.

You need to check is Ansible enabled.

  • Navigate to Manage Jenkins -> Manage Plugins -> Installed and check "Ansible Plugin" is enabled.
  • If it's not, then enable it and press the restart button at the bottom.

Last step is to Configure Ansible

  • Go to Manage Jenkins -> Global tool configuration
  • Scroll down and go to Ansible section and click "Ansible installations..."
  • In Name field, set any name you want
  • In Path to Ansible executables directory set "/usr/bin/" (For Ubuntu)

To get the path of Ansible installation use $ which ansible in terminal