我正在尝试为我的Maven项目运行jenkinsfile。我只是在尝试构建,测试和打包我的项目。以前,使用相同的脚本,我可以做到这些而没有任何错误,但是现在当我尝试执行相同的操作时,我得到的错误率已降至最低。
Running in Durability level: MAX_SURVIVABILITY
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 5: Invalid agent type "kubernetes" specified. Must be one of [any, docker, dockerfile, label, none] @ line 5, column 5.
kubernetes {
^
1个错误
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1085)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:603)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:581)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:558)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
at groovy.lang.GroovyShell.parseClass(GroovyShell.java:688)
at groovy.lang.GroovyShell.parse(GroovyShell.java:700)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:131)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:125)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:560)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:521)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:330)
at hudson.model.ResourceController.execute(ResourceController.java:97)
at hudson.model.Executor.run(Executor.java:429)
完成:失败
Jenkinsfile
#!groovy
pipeline{
agent {
kubernetes {
cloud 'openshift'
label 'jagathespike'
yamlFile 'jenkins/BuildPod.yaml'
}
}
stages{
stage('Maven Compile Stage'){
steps{
container('maven'){
sh 'mvn compile'
}
}
}
stage('Maven Test Stage'){
steps{
container('maven'){
sh 'mvn test'
}
}
}
stage('Maven Package Stage'){
steps{
container('maven'){
sh 'mvn package'
}
}
}
}
}
有人可以告诉我我在做什么错吗?