jenkins doesn't like my docker build am I forgetting something specifically I am getting this.
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")
this is the error and this is the 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")
}
}
}
}
'def' is causing you troubles as Jenkins file would expect a step not a groovy command.
Here is how I did this:
stage('Build Docker Image') {
steps{
script {
dockerImage = docker.build "${RegistryURL}/${ProjectName}:${ProjectVersion}"
}
}
}
where ${RegistryURL}, ${ProjectName}, ${ProjectVersion} are variables I defined in the upper part of the file in the environment section.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.