diff --git a/docker/tester/pull-repo.sh b/docker/tester/pull-repo.sh index 18619f1..5bdb673 100644 --- a/docker/tester/pull-repo.sh +++ b/docker/tester/pull-repo.sh @@ -33,14 +33,9 @@ then rm -rf "${cloneDir}" fi -printf "Cloning $( echo "${repoUrl}" | sed 's/\(.*:\/\/\).*@\(.*\)/\1\2/' ).\n" git clone "${repoUrl}" "${cloneDir}" cd "${cloneDir}" -printf "Tracking branch:\n" -git branch -vv - - # If a commit SHA is specified then detach the HEAD and point at the commit if [[ -n "${commit}" ]] then diff --git a/docker/tester/run-test-container.sh b/docker/tester/run-test-container.sh index 23c26e7..8111e06 100755 --- a/docker/tester/run-test-container.sh +++ b/docker/tester/run-test-container.sh @@ -29,12 +29,14 @@ set -o nounset # exit if undeclared variable is used githubApiKey=${1} team=${2} projectCommit=${3} -testImage=${4} -tempDir=${5} +projectBranch=${4} +testImage=${5} +tempDir=${6} docker run --cap-add=NET_ADMIN \ --env PROJECT_URL=https://${githubApiKey}@github.com/CS310-2017Jan/cpsc310project_${team}.git \ --env PROJECT_COMMIT=$projectCommit \ + --env PROJECT_BRANCH=$projectBranch \ --volume "${tempDir}":/output/ \ --rm \ ${testImage} diff --git a/docker/tester/run-tests.sh b/docker/tester/run-tests.sh index bfc6157..4b48d8c 100644 --- a/docker/tester/run-tests.sh +++ b/docker/tester/run-tests.sh @@ -23,7 +23,7 @@ # 1) Expects the deliverable repo exist in deliverableDir with up to date packages (node_modules) # ############################################################################## -version=1.0.1 +version=1.0.2 projectDir="/cpsc310project" @@ -38,7 +38,13 @@ testsCmd="yarn run autotest" date=$(date --utc +%FT%T.%3NZ) -printf "\n%s\n%s\n\n\n\n" "script version: ${version}" "test suite version: ${TESTSUITE_VERSION}" "${date}" +printf "\nproject url: %s\nbranch: %s\ncommit: %s\nscript version: %s\ntest suite version: %s\n\n\n\n" \ + "$( echo "${PROJECT_URL}" | sed 's/\(.*:\/\/\).*@\(.*\)/\1\2/' )" \ + "${PROJECT_BRANCH}" \ + "${PROJECT_COMMIT}" \ + "${version}" \ + "${TESTSUITE_VERSION}" \ + "${date}" # Clone the specified student repo into the projectDir @@ -46,7 +52,7 @@ printf "\n%s\n%s\n\n\n\n" "sc printf "\n" startTime=$(date +%s) -./pull-repo.sh $@ "${projectDir}" 2>&1 +./pull-repo.sh "${PROJECT_URL}" "${PROJECT_COMMIT}" "${projectDir}" 2>&1 status=$? duration=$(($(date +%s) - $startTime)) date=$(date --utc +%FT%T.%3NZ) diff --git a/src/model/results/TestRecord.ts b/src/model/results/TestRecord.ts index daf6210..038a372 100644 --- a/src/model/results/TestRecord.ts +++ b/src/model/results/TestRecord.ts @@ -102,6 +102,7 @@ export default class TestRecord implements DatabaseRecord { this.githubToken, this.team, this.commit, + this.ref, this.deliverable.image, tempDir.path ]; @@ -241,12 +242,12 @@ export default class TestRecord implements DatabaseRecord { public processInfoTag(stdout: string): any { try { - let infoTagRegex: RegExp = /^\nscript version: (.+)\ntest suite version: (.+)\n<\/INFO exitcode=(\d+), completed=(.+), duration=(\d+)s>$/gm + let infoTagRegex: RegExp = /^\nproject url: (.+)\nbranch: (.+)\ncommit: (.+)\nscript version: (.+)\ntest suite version: (.+)\n<\/INFO exitcode=(\d+), completed=(.+), duration=(\d+)s>$/gm //let infoMsgRegex: RegExp = /^(npm.*)$/gm; let matches: string[] = infoTagRegex.exec(stdout); let processed: any = { - scriptVersion: matches[1].trim(), - suiteVersion: matches[2].trim() + scriptVersion: matches[4].trim(), + suiteVersion: matches[5].trim() }; return processed; } catch (err) {