Merge "Tidy up collect output file names for cloned repos"

This commit is contained in:
Zuul 2018-10-01 18:39:20 +00:00 committed by Gerrit Code Review
commit b95853a1a7
2 changed files with 7 additions and 3 deletions

View File

@ -157,7 +157,11 @@ def _try_git_clone(repo_url, ref=None, proxy_server=None, auth_key=None):
# the name here is important as it bubbles back up to the output filename
# and ensure we handle url/foo.git/ cases. prefix is 'tmp' by default.
temp_dir = tempfile.mkdtemp(suffix=repo_url.rstrip('/').split('/')[-1])
root_temp_dir = tempfile.mkdtemp()
repo_name = repo_url.rstrip('/').split('/')[-1]
temp_dir = os.path.join(root_temp_dir, repo_name)
os.makedirs(temp_dir)
env_vars = _get_clone_env_vars(repo_url, ref, auth_key)
ssh_cmd = env_vars.get('GIT_SSH_COMMAND')

View File

@ -80,7 +80,7 @@ class TestSiteCliActions(object):
assert len(collected_files) == 1
# Validates that site manifests collected from cloned repositories
# are written out to sensibly named files like airship-treasuremap.yaml
assert collected_files[0].endswith("%s.yaml" % self.repo_name)
assert collected_files[0] == ("%s.yaml" % self.repo_name)
def test_collect_using_local_path(self):
"""Validates collect action using a path to a local repo."""
@ -103,4 +103,4 @@ class TestSiteCliActions(object):
assert len(collected_files) == 1
# Validates that site manifests collected from cloned repositories
# are written out to sensibly named files like airship-treasuremap.yaml
assert collected_files[0].endswith("%s.yaml" % self.repo_name)
assert collected_files[0] == ("%s.yaml" % self.repo_name)