詹金斯没有建立dockerfile
詹金斯不喜欢我的码头工人身材我忘了什么吗 特别是我得到了这个詹金斯没有建立dockerfile,docker,jenkins,jenkins-pipeline,Docker,Jenkins,Jenkins Pipeline,詹金斯不喜欢我的码头工人身材我忘了什么吗 特别是我得到了这个 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.MultipleCompilationErr
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")
这是错误,这是Jenkins文件
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")
}
}
}
}
“def”会给您带来麻烦,因为Jenkins文件期望的是一个步骤,而不是groovy命令 我是这样做的:
stage('Build Docker Image') {
steps{
script {
dockerImage = docker.build "${RegistryURL}/${ProjectName}:${ProjectVersion}"
}
}
}
其中${RegistryURL}、${ProjectName}、${ProjectVersion}是我在environment部分的文件上部定义的变量。全局变量调用需要包含在
脚本
块中。