Commit dac26f13 authored by Andrew Nicols's avatar Andrew Nicols

Task: File class name

parent 24cdc07d
......@@ -67,33 +67,35 @@ class Task {
}
def getPathToRunner() {
def runner
if (pathToRunner) {
if (!fileExists(pathToRunner)) {
runner = new File(pathToRunner)
if (!runner.exists()) {
throw new Exception("Unable to find job runner at ${pathToRunner}")
}
return pathToRunner
return runner.getName()
} else if (moodleVersion) {
def runner = new File("${script.env.HOME}/scripts/runner/${moodleVersion.name}/run.sh")
runner = new File("${script.env.HOME}/scripts/runner/${moodleVersion.name}/run.sh")
if (!runner.exists()) {
runner = new File("${script.env.HOME}/scripts/runner/master/run.sh")
}
return runner
return runner.getName()
} else {
def versionName = sh (
script: 'grep "\\$branch" moodle/version.php | sed "s/^[^\']*\'\\([^\']*\\).*\$/\\1/"',
returnStdout: true
).trim()
def runner = new File("${script.env.HOME}/scripts/runner/${versionName}/run.sh")
runner = new File("${script.env.HOME}/scripts/runner/${versionName}/run.sh")
if (!runner.exists()) {
runner = new File("${script.env.HOME}/scripts/runner/master/run.sh")
}
return runner
return runner.getName()
}
throw new Exception("Unable to determine path to script runner. Either a moodleVersion or a pathToRunner must be provided")
throw new Exception("Unable to determine path to script runner.")
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment