Support builds on a slave

Changes from https://issues.jenkins-ci.org/browse/JENKINS-6652.