Commit 0c5dc6fd authored by Andrew Nicols's avatar Andrew Nicols
Browse files

Task: Get the correct env

parent 25cb8505
......@@ -4,8 +4,6 @@ import org.moodle.ci.repositories.Repository
import org.moodle.ci.versions.Version
class Task {
def script
protected Repository repository
protected Version moodleVersion
......@@ -66,7 +64,7 @@ class Task {
throw new Exception("I don't know what PHP Version to test against")
}
def getPathToRunner() {
def getPathToRunner(env) {
def runner
if (pathToRunner) {
runner = new File(pathToRunner)
......@@ -76,9 +74,9 @@ class Task {
return runner.getAbsolutePath()
} else if (moodleVersion) {
runner = new File("${script.env.HOME}/scripts/runner/${moodleVersion.name}/run.sh")
runner = new File("${env.HOME}/scripts/runner/${moodleVersion.name}/run.sh")
if (!runner.exists()) {
runner = new File("${script.env.HOME}/scripts/runner/master/run.sh")
runner = new File("${env.HOME}/scripts/runner/master/run.sh")
}
return runner.getAbsolutePath()
......@@ -87,10 +85,10 @@ class Task {
script: 'grep "\\$branch" moodle/version.php | sed "s/^[^\']*\'\\([^\']*\\).*\$/\\1/"',
returnStdout: true
).trim()
runner = new File("${script.env.HOME}/scripts/runner/${versionName}/run.sh")
runner = new File("${env.HOME}/scripts/runner/${versionName}/run.sh")
if (!runner.exists()) {
runner = new File("${script.env.HOME}/scripts/runner/master/run.sh")
runner = new File("${env.HOME}/scripts/runner/master/run.sh")
}
return runner.getAbsolutePath()
......
......@@ -50,7 +50,7 @@ def call(org.moodle.ci.Task task) {
stage("Run Task") {
steps {
sh task.pathToRunner
sh task.getPathToRunner(env)
}
}
......
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