这是我的管道的一部分'''
stage('build') {
steps {
script {
docker.build("${env.IMAGENAME}:${env.LAST_COMMIT_TAG}")
}
}
}
stage('Deploy image') {
steps {
script{
docker.withRegistry(IMAGEHUBURL , CREDENTIALDOCKERHUB) {
docker.image("${env.IMAGENAME}:${env.LAST_COMMIT_TAG}").push()
}
}
}
}
stage('Delete docker image locally') {
steps{
docker.image("${env.IMAGENAME}:${env.LAST_COMMIT_TAG}").remove(message: "Removing outdated image")
}
}
'''
错误
“org.codehaus.groovy.control.MultipleCompilationErrorsException:启动失败:WorkflowScript:237:需要一个符号@第237行,第17列。docker.image(“$ {env.IMAGENAME}:$ {env.LAST_COMMIT_TAG}”).remove (消息:“删除过时的图像”)^
1 个错误
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:309)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:1107)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:624)
at org.codehaus.groovy.control.CompilationUnit.processPhaseOperations(CompilationUnit.java:602)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:579)
at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:323)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:293)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox$Scope.parse(GroovySandbox.java:163)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.doParse(CpsGroovyShell.java:190)
at org.jenkinsci.plugins.workflow.cps.CpsGroovyShell.reparse(CpsGroovyShell.java:175)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.parseScript(CpsFlowExecution.java:568)
at org.jenkinsci.plugins.workflow.cps.CpsFlowExecution.start(CpsFlowExecution.java:518)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:336)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)
完成:失败”
他对 docker.image().remove() 发誓,这可能是什么问题?