diff --git a/pegleg/engine/util/git.py b/pegleg/engine/util/git.py index b80a9f94..aafa7b15 100644 --- a/pegleg/engine/util/git.py +++ b/pegleg/engine/util/git.py @@ -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') diff --git a/tests/unit/test_cli.py b/tests/unit/test_cli.py index 3499983d..1bd90412 100644 --- a/tests/unit/test_cli.py +++ b/tests/unit/test_cli.py @@ -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)