summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMason Test Runner <mason@runner>2014-12-16 18:53:58 +0000
committerMason Test Runner <mason@runner>2014-12-16 18:53:58 +0000
commit0403501d0da30e4c1cc6c769efaf4a0f020a4c32 (patch)
treead916f234accf8fa0b0c29429e060a9aeb2f0789
parenta6bab4b14d49f2c0db25f9c43fba4ea5aec09669 (diff)
downloadsystem-tests-0403501d0da30e4c1cc6c769efaf4a0f020a4c32.tar.gz
Use local Git repo created by Zuul
Zuul passes us the commit ID of a merge commit that it created locally, so we must pass this repo to 'morph checkout'. If the repo in ZUUL_URL is used the commit will not be found, unless the merge happened to be a fast-forward merge. Also, clean up the workspace at the start of the test: it doesn't seem to get removed on error in all cases.
-rw-r--r--mason/tests/build.py30
1 files changed, 21 insertions, 9 deletions
diff --git a/mason/tests/build.py b/mason/tests/build.py
index c8fb5de..b98c4f7 100644
--- a/mason/tests/build.py
+++ b/mason/tests/build.py
@@ -18,6 +18,7 @@ import json
import logging
import morphlib
import os
+import shutil
import subprocess
import time
import urlparse
@@ -112,19 +113,30 @@ class Runner(mason.runners.JobRunner):
self.workspace = '/root/mason-workspace'
self.zuul_url = self.job_arguments['ZUUL_URL']
- url = urlparse.urlparse(self.zuul_url)
- self.defs_checkout = os.path.join(self.workspace,
- self.commit,
- url.hostname,
- '8080',
- self.project)
-
self._do_git_config()
+
+ if os.path.exists(self.workspace):
+ shutil.rmtree(self.workspace)
+
cliapp.runcmd(['morph', 'init', self.workspace])
- repo = 'http://%s:8080/%s' % (url.hostname, self.project)
- cliapp.runcmd(['morph', 'checkout', repo, self.commit],
+ zuul_gits_dir = 'var/lib/zuul/git/'
+
+ repo_dir = os.path.join('/', zuul_gits_dir, self.project)
+ cliapp.runcmd(['morph', 'checkout', repo_dir, self.commit],
cwd=self.workspace)
+
+ # Morph allows us to rename the system branch directory from the
+ # ludicrously long name that it chose for us.
+ temp_defs_checkout = os.path.join(
+ self.workspace, self.commit, zuul_gits_dir, self.project)
+ self.defs_checkout = os.path.join(
+ self.workspace, self.commit, self.project)
+ logging.debug(
+ 'Renaming system-branch directory from %s to %s',
+ temp_defs_checkout, self.defs_checkout)
+ os.renames(temp_defs_checkout, self.defs_checkout)
+
self.morph_helper = mason.util.MorphologyHelper(self.defs_checkout)
@mason.util.job_step