public class DockerHostTokenMacro extends DataBoundTokenMacro {
@Override
public String evaluate(AbstractBuild<?, ?> abstractBuild, TaskListener taskListener, String s) throws MacroEvaluationException, IOException, InterruptedException {
Node node = abstractBuild.getBuiltOn();
if( node instanceof DockerSlave) {
DockerSlave dockerSlave = (DockerSlave)node;
return dockerSlave.containerId;
}
return null;
}