/*
* Run default pipeline. See `pipeline.groovy for details.
*/
def pipeline;
def branch() {
if (env.BRANCH_NAME == null) {
return scm.getBranch();
} else {
return env.BRANCH_NAME;
}
}
stage ( "Load Pipeline") {
node {
/*
* Do not use default workspace here as checkout
* would erase all contents. Use a dedicated
* workspace instead
*/
ws ("workspace/${env.JOB_NAME}@loadpipeline") {
sshagent([ scm.getCredentialsId() ]) {
sh """
if [ -f pipeline.groovy ]; then
hg pull ${scm.getSource()}
else
hg clone ${scm.getSource()} .
fi
hg up ${branch()}
"""
}
pipeline = load "pipeline.groovy"
}
}
}
pipeline.build()
pipeline.test()