I have a declare pipeline, shown as follow:
pipeline{
agent any
stages{
stage("Pull Souce Code"){
steps{
checkout(...)
}
}
stage("Build and Push image"){
steps{
script{
docker.withRegistry(...){
def image = docker.build(...)
image.push()
}
}
}
}
}
}
The pipeline is running on the Jenkins Master(I don't build any jenkins slave). When I run this task concurrently, sometimes the Dockerfile referenced does not match the GitLab project.
I notice the current pipeline have 2 Jenkins workspace:
/var/lib/jenkins/workspace/job_name
and /var/lib/jenkins/workspace/job_name@2
Their Git files don't match their Dockerfile files.
I have to disable concurrent build now. What should I do?