要在jenkins上进行dockerize构建,需要哪些插件或预安装?
我一直有这个愚蠢的堆栈!
WorkflowScript: 74: Expected a symbol @ line 74, column 15.
docker.image('maven:3.3.3-jdk-8').inside("-v $PWD:/data") {
^
WorkflowScript: 74: "error" should have 1 arguments but has 2 arguments instead. @ line 74, column 15.
docker.image('maven:3.3.3-jdk-8').inside("-v $PWD:/data") {
编辑:我已经安装了docker管道插件
完整的jenkinsfile
stage('docker') {
steps {
checkout scm
docker.image('maven:3.3.3-jdk-8').inside("-v $PWD:/data") {
writeFile file: 'settings.xml', text: "<settings><localRepository>${pwd()}/.m2repo</localRepository></settings>"
sh 'mvn clean install'
}
}
最佳答案
您可以在issue JENKINS-44749中看到类似的错误
It seems the problem is deeper than I though since the Docker Pipeline Plugin also fails but with the following message:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 46: Expected a symbol @ line 46, column 25.
docker.image(‘node:7-alpine’).inside {
After reinstalling all plugins and updating Jenkins to 2.64 the original error is gone but I still get the error from the above comment.
Wrappingdocker.image
in ascript
block makes it work, but it wasn't needed before.
steps {
script {
docker.image('maven:3.3.3-jdk-8').inside("-v $PWD:/data") {
writeFile file: 'settings.xml', text: "<settings><localRepository>${pwd()}/.m2repo</localRepository></settings>"
sh 'mvn clean install'
}
}
}
关于docker - 要在jenkins上进行dockerize构建,需要哪些插件或预安装?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46374425/