Do test against a jenkins server ?

2 views
Skip to first unread message

Charles Moulliard

unread,
Dec 14, 2020, 9:41:05 AM12/14/20
to job-dsl-plugin
Hi,

Can we create some junit tests accessing a remote Jenkins Server and able to have access to a slave ?

Example of code that I would like to test

package groovy

import hudson.model.AbstractBuild;
import hudson.remoting.Channel;

def Channel channel;
def AbstractBuild build;

if(build.getWorkspace().isRemote()){
    channel = build.getWorkspace().channel
    println "Got a channel :-)"
}
def wksString = build.get
println "Remote WKS: $wksString"

String src = wksString + "/" + "pom.xml"
pomFile = new hudson.FilePath(channel, src)
....

Cheers

Charles


Reply all
Reply to author
Forward
0 new messages