From 1d640bc7ed51944bc59bb6d6e0ef1c58eed2df42 Mon Sep 17 00:00:00 2001 From: Kenneth Hoste Date: Tue, 24 Sep 2024 20:09:42 +0200 Subject: [PATCH] clone repository that holds build job script in job working directory rather than in a temporary directory --- tasks/build.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tasks/build.py b/tasks/build.py index 069a250..576d56b 100644 --- a/tasks/build.py +++ b/tasks/build.py @@ -747,17 +747,16 @@ def submit_job(job, cfg): error(f"Failed to determine path of build job script in repository from: {build_job_script}") # clone repo to temporary directory, and correctly set path to build job script - tmpdir = tempfile.mkdtemp() - repo_subdir = '-'.join(build_job_script_repo.split('/')[-2:]) - target_dir = os.path.join(tmpdir, repo_subdir) - os.makedirs(target_dir, exist_ok=True) + repo_subdir = build_job_script_repo.split('/')[-1] + if repo_subdir.endswith('.git'): + repo_subdir = repo_subdir[:-4] + os.makedirs(repo_subdir, exist_ok=True) - clone_output, clone_error, clone_exit_code = clone_git_repo(build_job_script_repo, target_dir) + clone_output, clone_error, clone_exit_code = clone_git_repo(build_job_script_repo, repo_subdir) if clone_exit_code != 0: error(f"Failed to clone repository {build_job_script_repo}: {clone_error}") - repo_subdir = '-'.join(build_job_script_repo.split('/')[-2:]) - build_job_script_path = os.path.join(tmpdir, repo_subdir, build_job_script_path) + build_job_script_path = os.path.join(repo_subdir, build_job_script_path) else: error(f"Incorrect build job script specification, unknown type: {build_job_script}")