I'm trying to create a Jenkins pipeline through Jenkinsfile with Shared Libraries. I created a job through the Web UI to get the Jenkinsfile, which is working ok. However, the shared library content do not seems to be recognizable by Jenkins. Below are the Jenkinsfile and the shared library content and the console error. I double checked the Jenkins general config (where the shared library scm is set) and the Pipeline plugin installation. Don't know where else to go.
Shared Library Content
# var/log.groovy def call(String name = 'human') { echo "Hello, ${name}." } Jenkinsfile Content
# Jenkinsfile @Library('jenkinstest') _ node { log("User!") } Log Error
Loading library jenkinstest@master Attempting to resolve master from remote references... > /usr/bin/git --version # timeout=10 using GIT_SSH to set credentials Gitlab ssh key > /usr/bin/git ls-remote -h -t #############/jenkinstest.git # timeout=10 Found match: refs/heads/master revision ############# > /usr/bin/git rev-parse --is-inside-work-tree # timeout=10 Fetching changes from the remote Git repository Fetching without tags Fetching upstream changes from git@##############/jenkinstest.git > /usr/bin/git --version # timeout=10 using GIT_SSH to set credentials Gitlab ssh key > /usr/bin/git fetch --no-tags --progress git@##############/jenkinstest.git +refs/heads/*:refs/remotes/origin/* Checking out Revision ############# (master) > /usr/bin/git config core.sparsecheckout # timeout=10 > /usr/bin/git checkout -f ############# Commit message: "fix on groovy" > /usr/bin/git rev-list --no-walk ############# # timeout=10 [Pipeline] node Running on jenkins-node3 in /Users/admin/jenkins-home/workspace/automation-pipeline [Pipeline] { [Pipeline] } [Pipeline] // node [Pipeline] End of Pipeline java.lang.NoSuchMethodError: No such DSL method 'log' found among steps [acceptGitLabMR, addGitLabMRComment, ansiColor, archive, bat, build, catchError, checkout, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, echo, emailext, emailextrecipients, envVarsForTool, error, fileExists, getContext, git, gitlabBuilds, gitlabCommitStatus, input, isUnix, jiraComment, jiraIssueSelector, jiraSearch, junit, library, libraryResource, load, mail, milestone, node, parallel, powershell, properties, publishHTML, pwd, readFile, readTrusted, resolveScm, retry, script, sh, slackSend, sleep, sshagent, stage, stash, step, svn, task, throttle, timeout, timestamps, tm, tool, unarchive, unstash, updateGitlabCommitStatus, validateDeclarativePipeline, waitUntil, withContext, withCredentials, withDockerContainer, withDockerRegistry, withDockerServer, withEnv, wrap, writeFile, ws] or symbols [all, allOf, always, ant, antFromApache, antOutcome, antTarget, any, anyOf, apiToken, architecture, archiveArtifacts, artifactManager, authorizationMatrix, batchFile, bitbucket, booleanParam, branch, buildButton, buildDiscarder, buildParameter, caseInsensitive, caseSensitive, certificate, changelog, changeset, choice, choiceParam, cleanWs, clock, cloud, command, compressBuildLog, configFile, configFileProvider, copyArtifacts, credentials, cron, crumb, defaultView, demand, disableConcurrentBuilds, docker, dockerCert, dockerfile, downloadSettings, downstream, dumb, envVars, environment, expression, file, fileParam, filePath, fingerprint, frameOptions, freeStyle, freeStyleJob, fromScm, fromSource, git, gitLabConnection, github, githubPush, gitlab, gradle, headRegexFilter, headWildcardFilter, hyperlink, hyperlinkToModels, inheriting, inheritingGlobal, installSource, jdk, jdkInstaller, jgit, jgitapache, jnlp, jobName, label, lastCompleted, lastDuration, lastFailure, lastGrantedAuthorities, lastStable, lastSuccess, lastSuccessful, latestSavedBuild, legacy, legacySCM, list, local, location, logRotator, loggedInUsersCanDoAnything, masterBuild, maven, maven3Mojos, mavenErrors, mavenMojos, mavenWarnings, modernSCM, myView, node, nodeProperties, nonInheriting, nonStoredPasswordParam, none, not, nunit, overrideIndexTriggers, paneStatus, parameterizedCron, parameters, password, pattern, permalink, pipeline-model, pipelineTriggers, plainText, plugin, pollSCM, projectNamingStrategy, proxy, queueItemAuthenticator, quietPeriod, remotingCLI, run, runParam, schedule, scmRetryCount, search, security, shell, skipDefaultCheckout, skipStagesAfterUnstable, slave, sourceRegexFilter, sourceWildcardFilter, specific, sshUserPrivateKey, stackTrace, standard, status, string, stringParam, swapSpace, text, textParam, tmpSpace, toolLocation, unsecured, upstream, usernameColonPassword, usernamePassword, viewsTabBar, weather, withAnt, workspace, zfs, zip] or globals [currentBuild, docker, env, manager, params, pipeline, scm]
import logunderneath the@Library?vars? In every example they have the folder vars instead of var in which they put their scripts. I think it's really necessary that it's called vars.