[pipeline-model-definition] No such DSL method 'credentials'

264 views
Skip to first unread message

Andreas Magnusson

unread,
Nov 16, 2016, 1:46:19 AM11/16/16
to Jenkins Users
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]

stacktrace.txt
Reply all
Reply to author
Forward
0 new messages