jenkins不喜欢我的docker版本,是不是我忘记了什么,特别是我得到了这个。
Started by user admin
Obtained Jenkinsfile from git http://gitlab.operasolutions.com/procurement-ai/procurement-ai-ui.git
Running in Durability level: MAX_SURVIVABILITY
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 17: Expected a step @ line 17, column 17.
def app = docker.build("procurementai-ui")这是错误,这是jenkinsfile
pipeline {
agent any
stages {
stage('build') {
steps {
sh 'echo build'
}
}
stage('verify') {
steps {
sh 'ls -alF target'
}
}
stage('docker') {
steps{
sh 'cd /home/jenkins/agent/workspace/procurementai-ui'
def app = docker.build("procurementai-ui")
}
}
}
}发布于 2020-02-26 16:57:27
‘'def’给你带来了麻烦,因为Jenkins文件期望的是一个步骤,而不是一个groovy命令。
下面是我是如何做到的:
stage('Build Docker Image') {
steps{
script {
dockerImage = docker.build "${RegistryURL}/${ProjectName}:${ProjectVersion}"
}
}
}其中${RegistryURL}、${ProjectName}、${ProjectVersion}是我在文件上部环境部分定义的变量。
https://stackoverflow.com/questions/60397654
复制相似问题