Jenkins fails to run any job, getting "No such DSL method 'job' found among steps"

6,997 views
Skip to first unread message

Christian

unread,
Sep 28, 2017, 2:34:03 AM9/28/17
to job-dsl-plugin
I am trying to create a job to run the nexus-artifact-uploader-plugin, which requires the Job DSL. But it fails when using "freeStyleJob". So far I've read that "job" is an alias for "freeStyleJob", so I wanted to create a minimal job:
node {
job('DSL-Tutorial-1-Test') {
steps {
maven('clean')
}
}

But it fails with the following error message:

java.lang.NoSuchMethodError: No such DSL method 'job' found among steps [acceptGitLabMR, addGitLabMRComment, archive, bat, build, catchError, checkout, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, echo, emailext, emailextrecipients, envVarsForTool, error, fileExists, getContext, git, gitlabBuilds, gitlabCommitStatus, input, isUnix, library, libraryResource, load, mail, milestone, node, parallel, powershell, properties, publishHTML, pwd, readFile, readTrusted, resolveScm, retry, script, sh, sleep, stage, stash, step, svn, timeout, timestamps, tm, tool, unarchive, unstash, updateGitlabCommitStatus, validateDeclarativePipeline, waitUntil, withContext, withCredentials, withDockerContainer, withDockerRegistry, withDockerServer, withEnv, withMaven, wrap, writeFile, ws] or symbols [all, allOf, always, ant, antFromApache, antOutcome, antTarget, any, anyOf, apiToken, architecture, archiveArtifacts, artifactManager, artifactsPublisher, batchFile, bitbucket, booleanParam, branch, buildButton, buildDiscarder, caseInsensitive, caseSensitive, certificate, changelog, changeset, checkstyle, choice, choiceParam, cleanWs, clock, cloud, command, concordionPublisher, configFile, configFileProvider, credentials, cron, crumb, defaultView, demand, dependenciesFingerprintPublisher, disableConcurrentBuilds, docker, dockerCert, dockerfile, downloadSettings, downstream, dumb, envVars, environment, expression, file, fileParam, filePath, findbugs, findbugsPublisher, fingerprint, frameOptions, freeStyle, freeStyleJob, fromScm, fromSource, git, gitLabConnection, github, githubPush, gitlab, gradle, headRegexFilter, headWildcardFilter, hyperlink, hyperlinkToModels, installSource, invokerPublisher, jdk, jdkInstaller, jgit, jgitapache, jnlp, jobDsl, jobName, junit, junitPublisher, label, lastDuration, lastFailure, lastGrantedAuthorities, lastStable, lastSuccess, legacy, legacySCM, list, local, location, logRotator, loggedInUsersCanDoAnything, masterBuild, maven, maven3Mojos, mavenErrors, mavenMojos, mavenWarnings, modernSCM, myView, node, nodeProperties, nonStoredPasswordParam, none, not, openTasksPublisher, overrideIndexTriggers, paneStatus, parameters, password, pattern, pipeline-model, pipelineGraphPublisher, pipelineMaven, pipelineTriggers, plainText, plugin, pollSCM, projectNamingStrategy, proxy, queueItemAuthenticator, quietPeriod, remotingCLI, run, runParam, schedule, scmRetryCount, search, security, shell, skipDefaultCheckout, skipStagesAfterUnstable, slave, snapshotDependencies, sourceRegexFilter, sourceWildcardFilter, sshUserPrivateKey, stackTrace, standard, status, string, stringParam, swapSpace, text, textParam, tmpSpace, toolLocation, unsecured, upstream, usernameColonPassword, usernamePassword, viewsTabBar, weather, withAnt, zfs, zip] or globals [currentBuild, docker, env, params, pipeline, scm]


Great, especially that it has the freeStyleJob. But that won't work either. When I use "freeStyleJob" instead I get an error that it expects named arguments instead of a simple string.

My Jenkins is running in a docker container in version 2.73.1 and my Job DSL plugin is version 1.65.

What am I doing wrong here?

Daniel Spilker

unread,
Sep 28, 2017, 2:39:05 AM9/28/17
to job-dsl-plugin
It looks like you are mixing Pipeline DSL and Job DSL, which is not possible.


Daniel

Christian

unread,
Sep 28, 2017, 2:56:15 AM9/28/17
to job-dsl-plugin
Oh... I thought the Job DSL syntax is some kind of addition. Is there any way to still use it inside the pipeline dsl?

Daniel Spilker

unread,
Sep 28, 2017, 3:01:22 AM9/28/17
to job-dsl-plugin

Christian

unread,
Sep 28, 2017, 3:02:02 AM9/28/17
to job-dsl-plugin
Thank you very much!
Reply all
Reply to author
Forward
0 new messages