Hi, 
I'm trying to convert our pipeline build to work with 
pipeline-model-definition, but have a problem.
According to the docs 
(https://github.com/jenkinsci/pipeline-model-definition-plugin/blob/master/SYNTAX.md)
 
I should be able to create a small example like this:

pipeline {
    agent any
    
    environment {
        SECRET = credentials('secret')
    }
    
    stages {
        stage('build') {
            steps {
                echo env.SECRET
            }
        }
    }
}

However, when I run this in Jenkins 2.31 and all the pipeline plugins 
up-to-date I get the stacktrace (full stacktrace attached) at the bottom of 
my message.

Does anyone have an idea what's wrong?

Cheers,
Andreas

java.lang.NoSuchMethodError: No such DSL method 'credentials' found among steps 
[archive, bat, build, catchError, checkout, deleteDir, dir, 
dockerFingerprintFrom, dockerFingerprintRun, dockerLabel, echo, emailext, 
emailextrecipients, envVarsForTool, error, fileExists, getContext, git, input, 
isUnix, jiraComment, jiraIssueSelector, jiraSearch, libraryResource, load, 
mail, milestone, node, parallel, properties, publishHTML, pwd, readFile, 
readTrusted, retry, script, sh, sleep, stage, stash, step, svn, timeout, 
timestamps, tool, unarchive, unstash, waitUntil, withContext, withCredentials, 
withDockerContainer, withDockerRegistry, withDockerServer, withEnv, withMaven, 
wrap, writeFile, ws] or symbols [all, always, ant, antFromApache, antOutcome, 
antTarget, any, apiToken, architecture, archiveArtifacts, artifactManager, 
batchFile, booleanParam, buildButton, buildDiscarder, caseInsensitive, 
caseSensitive, choice, choiceParam, clock, cloud, command, configFile, 
configFileProvider, cron, crumb, defaultView, demand, disableConcurrentBuilds, 
docker, downloadSettings, downstream, dumb, envVars, file, fileParam, filePath, 
fingerprint, frameOptions, freeStyle, freeStyleJob, git, hyperlink, 
hyperlinkToModels, installSource, jdk, jdkInstaller, jgit, jgitapache, jnlp, 
jobDsl, jobName, junit, label, lastDuration, lastFailure, 
lastGrantedAuthorities, lastStable, lastSuccess, legacy, list, local, location, 
logRotator, loggedInUsersCanDoAnything, masterBuild, maven, maven3Mojos, 
mavenErrors, mavenMojos, mavenWarnings, myView, nodeProperties, 
nonStoredPasswordParam, none, overrideIndexTriggers, paneStatus, parameters, 
password, pattern, pipeline-model, pipelineTriggers, plainText, plugin, 
pollSCM, projectNamingStrategy, proxy, queueItemAuthenticator, quietPeriod, 
run, runParam, schedule, scmRetryCount, search, security, shell, slave, 
stackTrace, standard, status, string, stringParam, swapSpace, text, textParam, 
tmpSpace, toolLocation, unsecured, upstream, usernameColonPassword, 
usernamePassword, viewsTabBar, weather, withSonarQubeEnv, zfs, zip] or globals 
[currentBuild, docker, env, params, pipeline, scm]


-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/8d907c96-1507-417f-98e0-8ef704131555%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
java.lang.NoSuchMethodError: No such DSL method 'credentials' found among steps 
[archive, bat, build, catchError, checkout, deleteDir, dir, 
dockerFingerprintFrom, dockerFingerprintRun, dockerLabel, echo, emailext, 
emailextrecipients, envVarsForTool, error, fileExists, getContext, git, input, 
isUnix, jiraComment, jiraIssueSelector, jiraSearch, libraryResource, load, 
mail, milestone, node, parallel, properties, publishHTML, pwd, readFile, 
readTrusted, retry, script, sh, sleep, stage, stash, step, svn, timeout, 
timestamps, tool, unarchive, unstash, waitUntil, withContext, withCredentials, 
withDockerContainer, withDockerRegistry, withDockerServer, withEnv, withMaven, 
wrap, writeFile, ws] or symbols [all, always, ant, antFromApache, antOutcome, 
antTarget, any, apiToken, architecture, archiveArtifacts, artifactManager, 
batchFile, booleanParam, buildButton, buildDiscarder, caseInsensitive, 
caseSensitive, choice, choiceParam, clock, cloud, command, configFile, 
configFileProvider, cron, crumb, defaultView, demand, disableConcurrentBuilds, 
docker, downloadSettings, downstream, dumb, envVars, file, fileParam, filePath, 
fingerprint, frameOptions, freeStyle, freeStyleJob, git, hyperlink, 
hyperlinkToModels, installSource, jdk, jdkInstaller, jgit, jgitapache, jnlp, 
jobDsl, jobName, junit, label, lastDuration, lastFailure, 
lastGrantedAuthorities, lastStable, lastSuccess, legacy, list, local, location, 
logRotator, loggedInUsersCanDoAnything, masterBuild, maven, maven3Mojos, 
mavenErrors, mavenMojos, mavenWarnings, myView, nodeProperties, 
nonStoredPasswordParam, none, overrideIndexTriggers, paneStatus, parameters, 
password, pattern, pipeline-model, pipelineTriggers, plainText, plugin, 
pollSCM, projectNamingStrategy, proxy, queueItemAuthenticator, quietPeriod, 
run, runParam, schedule, scmRetryCount, search, security, shell, slave, 
stackTrace, standard, status, string, stringParam, swapSpace, text, textParam, 
tmpSpace, toolLocation, unsecured, upstream, usernameColonPassword, 
usernamePassword, viewsTabBar, weather, withSonarQubeEnv, zfs, zip] or globals 
[currentBuild, docker, env, params, pipeline, scm]
        at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:149)
        at 
org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:108)
        at 
org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:48)
        at 
org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
        at 
org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
        at 
com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:18)
        at 
org.jenkinsci.plugins.pipeline.modeldefinition.PropertiesToMapTranslator.methodMissing(jar:file:/C:/Users/AMagnusson/.jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/PropertiesToMapTranslator.groovy:43)
        at WorkflowScript.run(WorkflowScript:5)
        at 
org.jenkinsci.plugins.pipeline.modeldefinition.ClosureModelTranslator.resolveClosure(jar:file:/C:/Users/AMagnusson/.jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ClosureModelTranslator.groovy:211)
        at 
org.jenkinsci.plugins.pipeline.modeldefinition.ClosureModelTranslator.methodMissing(jar:file:/C:/Users/AMagnusson/.jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ClosureModelTranslator.groovy:135)
        at WorkflowScript.run(WorkflowScript:4)
        at 
org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(jar:file:/C:/Users/AMagnusson/.jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:61)
        at WorkflowScript.run(WorkflowScript:1)
        at ___cps.transform___(Native Method)
        at 
com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57)
        at 
com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109)
        at 
com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82)
        at sun.reflect.GeneratedMethodAccessor310.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at 
com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
        at 
com.cloudbees.groovy.cps.impl.LocalVariableBlock$LocalVariable.get(LocalVariableBlock.java:39)
        at 
com.cloudbees.groovy.cps.LValueBlock$GetAdapter.receive(LValueBlock.java:30)
        at 
com.cloudbees.groovy.cps.impl.LocalVariableBlock.evalLValue(LocalVariableBlock.java:28)
        at 
com.cloudbees.groovy.cps.LValueBlock$BlockImpl.eval(LValueBlock.java:55)
        at com.cloudbees.groovy.cps.LValueBlock.eval(LValueBlock.java:16)
        at com.cloudbees.groovy.cps.Next.step(Next.java:58)
        at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:154)
        at 
org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$001(SandboxContinuable.java:18)
        at 
org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:33)
        at 
org.jenkinsci.plugins.workflow.cps.SandboxContinuable$1.call(SandboxContinuable.java:30)
        at 
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108)
        at 
org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)
        at 
org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:163)
        at 
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:324)
        at 
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$100(CpsThreadGroup.java:78)
        at 
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:236)
        at 
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:224)
        at 
org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:63)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at 
hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
        at 
jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Finished: FAILURE

Reply via email to