I'm trying to run a groovy script which is updating the build.description
during the execution while running a process on a slave node.
My problem is that a "system groovy script' executes only on the master node and 'Jenkins groovy scripts' run on slave nodes but have no access to the build
variable.
I have a script similar to this one:
import hudson.model.*
// works on slave node
def param = args[0]
// works on master node
//def param = build.getEnvironment(listener).get('Params')
def ws = new File(".").absolutePath
def myCommand = ws + "\\Something.exe " + param
def proc = myCommand.execute();
// Cannot use on slave
build.description = "Running executable..."
int exitVal = proc.waitFor();
// Cannot use on slave
build.description = "Executable finished"
Is there a way to modify the build variable on a "Jenkins Groovy Script" which runs on a slave?
Thanks in advance!
No.
Jenkins pipeline exposes more control on such things.
Following is from script we have. nodeexpression
could a node name.
node(nodeexpression) {
println "env :"
echo sh(script: 'env|sort', returnStdout: true)
currentBuild.displayName = "branch ${BRANCH}:${MAIL_TO}"
currentBuild.description = "${BRANCH}:${MAIL_TO} : message -> ${MESSAGE}"
}
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.