I have a Master (Unix) and a slave Machine (Windows). I have created a Multibranch pipeline Project on Master and Trigger request all of the Process takes place in Slave. I am trying to send the HTML reports which are being generated at the Slave machine but get Exception:
ERROR: Error: No workspace found!
Sending email to: [email protected]
[Pipeline] }
[Pipeline] // stage
[Pipeline] End of Pipeline
Finished: SUCCESS
I am using the below code in Jenkinsfile:
success {
emailext attachmentsPattern: '**/overview-features.html',
body: '${SCRIPT, template="groovy-html.template"}',
mimeType: 'text/html',
subject: 'Success Pipeline: ${currentBuild.fullDisplayName}',
to: '[email protected]'
}
The file should be attached to the email and sent. Currently it shows ERROR:
Error: No workspace found!
From my tests it seems the agent none
case has a problem in configurations where the workspace is not allocated on the master.
agent none
allows to set agents per stage, but the post()
block doesn't allow to set an agent, it will run on master without workspace on the case of agent none
from what i gathered.
So the only solution for declarative pipeline in that case would be to run the whole build on agent with label Developer30, if your example is complete it should be no problem.
pipeline {
agent {
label 'Developer30'
}
tools {
maven 'MAVEN_HOME'
}
stages {
stage ('Compile Stage') {
steps {
bat 'mvn clean'
}
}
}
post {
success {
// emailext stuff
}
}
}