我需要使用groovy在kaniko中构建docker镜像(该镜像无需守护进程即可构建),并将该镜像推到azure acr。
不幸的是,它抛出了我-第25行的错误甚至不存在。请咨询
package com.foo.utils
public void Kaniko(body) {
podTemplate(label: label,
containers: [containerTemplate(name: 'Kaniko', image: 'gcr.io/kaniko-project/executor:debug', ttyEnabled: true, command: '/busybox/cat')],
volumes: [hostPathVolume(hostPath: '/var/run/docker.sock', mountPath: '/var/run/docker.sock')]) {
body(
{
node(label) {
stage('Kaniko') {
git 'https://github.com/ab1234567/hellonode.git'
container('Kaniko') {
stage('Build a project') {
sh /kaniko/executor -f ./Dockerfile
}
}
}
}
}
)
}
}
return this
当我使用Jenkins groovy脚本进行编译时,出现错误
[kaniko] $ groovy /var/lib/jenkins/workspace/kaniko/kaniko.groovy
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/var/lib/jenkins/workspace/kaniko/kaniko.groovy: 25: unexpected char: 0xFFFF @ line 25, column 1.
1 error
Build step 'Execute Groovy script' marked build as failure
Finished: FAILURE
请您指教。