summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Coldrick <adam.coldrick@codethink.co.uk>2015-02-02 14:53:41 +0000
committerAdam Coldrick <adam.coldrick@codethink.co.uk>2015-02-02 14:53:41 +0000
commitebdcbeb9b70e79097b4338bfc0c101b3e4f277d4 (patch)
treefe99af423b50c4ff9fec75da1a6834a9c8eb9800
parentfe366446a5a7a510d0a727f0eb1d3e4596856c73 (diff)
downloadsystem-tests-ebdcbeb9b70e79097b4338bfc0c101b3e4f277d4.tar.gz
Fix checkout of definitions in artifact_upload plugin
-rw-r--r--mason/tests/artifact_upload.py34
1 files changed, 23 insertions, 11 deletions
diff --git a/mason/tests/artifact_upload.py b/mason/tests/artifact_upload.py
index 62e74e1..11a7968 100644
--- a/mason/tests/artifact_upload.py
+++ b/mason/tests/artifact_upload.py
@@ -1,4 +1,4 @@
-# Copyright 2014 Codethink Ltd
+# Copyright 2014-2015 Codethink Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -104,19 +104,31 @@ 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.morph_helper = mason.util.MorphologyHelper(self.defs_checkout)
-
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], cwd=self.workspace)
+ 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
def _publish_build_artifacts(self):