Jenkins构建与kubernetes集成失败,没有这样的DSL方法错误

Jenkins构建与kubernetes集成失败,没有这样的DSL方法错误,jenkins,kubernetes,Jenkins,Kubernetes,我的jenkins multi-branch pipeline作业由于DSL方法失败而失败,我安装了所需的插件,但我的作业仍在下降,请查找以下代码 def label = "worker-${UUID.randomUUID().toString()}" podTemplate(label: label, containers: [ containerTemplate(name: 'nodejs', image: 'node:10-buster', tty

我的jenkins multi-branch pipeline作业由于DSL方法失败而失败,我安装了所需的插件,但我的作业仍在下降,请查找以下代码

    def label = "worker-${UUID.randomUUID().toString()}"

    podTemplate(label: label, containers: [
            containerTemplate(name: 'nodejs', image: 'node:10-buster', ttyEnabled: true, command: 'cat'),
                containerTemplate(name: 'docker', image: 'docker:1.12.6', command: 'cat', ttyEnabled: true),
        containerTemplate(name: 'sonarqube', image: 'sonarsource/sonar-scanner-cli:latest', command: 'cat', ttyEnabled: true),
        containerTemplate(name: 'kubectl', image: 'lachlanevenson/k8s-kubectl:v1.8.3', command: 'cat', ttyEnabled: true)

    ],
    volumes: [
       hostPathVolume(mountPath: '/var/run/docker.sock', hostPath: '/var/run/docker.sock'),
      hostPathVolume(hostPath: '/root/.m2/repository', mountPath: '/root/.m2/repository')

]) {
  node(label) {
    def myRepo = checkout scm
    def gitCommit = myRepo.GIT_COMMIT
    def gitBranch = myRepo.GIT_BRANCH
    def shortGitCommit = "${gitCommit[0..10]}"
    def previousGitCommit = sh(script: "git rev-parse ${gitCommit}~", returnStdout: true)

stage('NPM Install') {
            container ('nodejs') {
                withEnv(["NPM_CONFIG_LOGLEVEL=warn"]) {
                    sh 'npm install'
                 }
            }
          }
詹金斯日志

java.lang.NoSuchMethodError: No such DSL method 'stage' found among steps [archive, bat, catchError, checkout, container, containerLog, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, dockerNode, echo, error, fileExists, getContext, git, isUnix, junit, load, mail, node, parallel, podTemplate, powershell, properties, pwd, pwsh, readFile, readTrusted, resolveScm, retry, sh, sleep, stash, step, timeout, tm, tool, unarchive, unstable, unstash, waitUntil, warnError, withContext, withCredentials, withDockerContainer, withDockerRegistry, withDockerServer, withEnv, wrap, writeFile, ws] or symbols [all, always, apiToken, architecture, archiveArtifacts, artifactManager, attach, authorizationMatrix, batchFile, booleanParam, buildButton, buildDiscarder, caseInsensitive, caseSensitive, certificate, choice, choiceParam, clock, cloud, command, configFile, configFileProvider, configMapVolume, containerEnvVar, containerLivenessProbe, containerTemplate, credentials, cron, crumb, default, defaultFolderConfiguration, defaultView, demand, disableConcurrentBuilds, disableResume, dockerCert, downstream, dumb, durabilityHint, dynamicPVC, emptyDirVolume, emptyDirWorkspaceVolume, envVar, envVars, executor, file, fileParam, filePath, fingerprint, frameOptions, freeStyle, freeStyleJob, fromScm, fromSource, git, gitBranchDiscovery, gitHubBranchDiscovery, gitHubBranchHeadAuthority, gitHubForkDiscovery, gitHubSshCheckout, gitHubTagDiscovery, gitHubTrustContributors, gitHubTrustEveryone, gitHubTrustNobody, gitHubTrustPermissions, gitTagDiscovery, github, githubPush, globalConfigFiles, headRegexFilter, headWildcardFilter, hostPathVolume, hostPathWorkspaceVolume, hyperlink, hyperlinkToModels, inheriting, inheritingGlobal, installSource, jdk, jdkInstaller, jgit, jgitapache, jnlp, jobName, lastDuration, lastFailure, lastGrantedAuthorities, lastStable, lastSuccess, legacy, list, local, location, logRotator, loggedInUsersCanDoAnything, masterBuild, maven, maven3Mojos, mavenErrors, mavenMojos, mavenWarnings, merge, myView, never, nfsVolume, nfsWorkspaceVolume, nodeProperties, nodejs, nodejsci, nonInheriting, none, onFailure, override, overrideIndexTriggers, paneStatus, parameters, password, pattern, permanent, persistentVolumeClaim, persistentVolumeClaimWorkspaceVolume, pipelineTriggers, plainText, plugin, podAnnotation, podEnvVar, podLabel, pollSCM, portMapping, projectNamingStrategy, proxy, queueItemAuthenticator, quietPeriod, rateLimitBuilds, resourceRoot, run, runParam, sSHLauncher, schedule, scmRetryCount, scriptApproval, scriptApprovalLink, search, secretEnvVar, secretVolume, security, shell, slave, sourceRegexFilter, sourceWildcardFilter, ssh, sshUserPrivateKey, stackTrace, standard, status, string, stringParam, swapSpace, text, textParam, timezone, tmpSpace, toolLocation, unsecured, upstream, userSeed, usernameColonPassword, usernamePassword, viewsTabBar, weather, workspace, zfs, zip] or globals [currentBuild, docker, env, params, scm]

我忘了为多管道作业安装“模型定义插件”,在安装脚本上面的插件后效果很好。

我想这个问题在这里得到了回答