Jnekins 缺少Pipeline插件 流水线报错 at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:216)

查看提示报错信息如下:

Running in Durability level: MAX_SURVIVABILITY
[Pipeline] Start of Pipeline
[Pipeline] End of Pipeline
java.lang.NoSuchMethodError: No such DSL method 'pipeline' found among steps [bat, build, checkout, container, containerLog, input, junit, kubernetesDeploy, library, libraryResource, load, milestone, node, parallel, podTemplate, powershell, properties, pwsh, readTrusted, resolveScm, sh, stage, svn, timestamps, tm, withCredentials, ws] or symbols [all, allBranchesSame, always, ant, antFromApache, antOutcome, antTarget, apiToken, architecture, archiveArtifacts, artifactManager, authorizationMatrix, batchFile, booleanParam, buildButton, buildDiscarder, buildDiscarders, buildRetention, caseInsensitive, caseSensitive, certificate, choice, choiceParam, cleanWs, clock, command, configMapVolume, containerEnvVar, containerLivenessProbe, containerTemplate, credentials, cron, crumb, default, defaultFolderConfiguration, defaultView, demand, disableConcurrentBuilds, disableResume, dockerCert, downstream, dumb, durabilityHint, dynamicPVC, emptyDirVolume, emptyDirWorkspaceVolume, envVar, envVars, envVarsFilter, file, fileParam, filePath, fingerprint, fingerprints, frameOptions, freeStyle, freeStyleJob, fromScm, fromSource, git, headRegexFilter, headWildcardFilter, hostPathVolume, hostPathWorkspaceVolume, hyperlink, hyperlinkToModels, inheriting, inheritingGlobal, installSource, jdk, jdkInstaller, jgit, jgitapache, jnlp, jobBuildDiscarder, jobName, kubeconfigContent, kubeconfigFile, kubernetes, lastDuration, lastFailure, lastGrantedAuthorities, lastStable, lastSuccess, legacy, legacySCM, list, local, location, logRotator, loggedInUsersCanDoAnything, masterBuild, maven, maven3Mojos, mavenErrors, mavenMojos, mavenWarnings, merge, modernSCM, myView, namedBranchesDifferent, never, nfsVolume, nfsWorkspaceVolume, nodeProperties, nonInheriting, none, onFailure, override, overrideIndexTriggers, paneStatus, parameters, password, pattern, permanent, persistentVolumeClaim, persistentVolumeClaimWorkspaceVolume, pipelineTriggers, plainText, plugin, podAnnotation, podEnvVar, podLabel, pollSCM, portMapping, projectNamingStrategy, proxy, queueItemAuthenticator, quietPeriod, rateLimit, rateLimitBuilds, resourceRoot, retainOnlyVariables, run, runParam, sSHLauncher, schedule, scmRetryCount, scriptApproval, scriptApprovalLink, search, secretEnvVar, secretVolume, security, shell, simpleBuildDiscarder, slave, sourceRegexFilter, sourceWildcardFilter, ssh, sshPublicKey, sshUserPrivateKey, standard, status, string, stringParam, suppressAutomaticTriggering, swapSpace, text, textParam, timestamper, timestamperConfig, timezone, tmpSpace, toolLocation, unsecured, untrusted, upstream, userSeed, usernameColonPassword, usernamePassword, viewsTabBar, weather, withAnt, zfs, zip] or globals [currentBuild, env, params, scm]
	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:216)
	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:122)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)

在这里插入图片描述
OK,安装pipeline插件。
管理詹金斯 ->管理插件-> 安装插件(pipeline)
在这里插入图片描述

一、项目内容

pipeline {
   agent { label 'jnlp-slave'}   //指定标签为jnlp-slave节点
    environment {
        DISABLE_AUTH = 'true'     //定义变量 DISABLE_AUTH
        DB_ENGINE    = 'sqlite'      //定义变量 DB_ENGINE 
    }

    stages {	    //阶段(相当于一个部门)
        stage('Build') {    //脚步(相当于一个部门中的人员数据库、架构、运维、安全)	
            steps {  //脚步内的步骤(职责人员执行自己负责的任务)
                echo "Database engine is ${DB_ENGINE}"
                echo "DISABLE_AUTH is ${DISABLE_AUTH}"
                sh 'printenv'
            }
        }
    }
}

再次构建

在这里插入图片描述

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值