From 8cf948212a3facb7189e8fde510bb68b960f31e4 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 10 Apr 2025 13:22:33 -0600 Subject: [PATCH] Use uv's venv path Signed-off-by: Zack Cerza --- bootstrap | 2 ++ containers/teuthology-dev/teuthology.sh | 2 +- docs/docker-compose/teuthology/teuthology.sh | 2 +- teuthology/dispatcher/__init__.py | 2 +- teuthology/dispatcher/test/test_dispatcher.py | 2 +- teuthology/repo_utils.py | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bootstrap b/bootstrap index cd6638a0a..2145e17cc 100755 --- a/bootstrap +++ b/bootstrap @@ -86,6 +86,8 @@ fi command -v uv > /dev/null || pipx ensurepath PATH=$PATH:$HOME/.local/bin uv sync --frozen --all-extras +# To avoid crashing older dispatchers +ln -sf .venv virtualenv # Install ansible collections uv run ansible-galaxy install -r requirements.yml diff --git a/containers/teuthology-dev/teuthology.sh b/containers/teuthology-dev/teuthology.sh index 373f6efb8..49219d205 100755 --- a/containers/teuthology-dev/teuthology.sh +++ b/containers/teuthology-dev/teuthology.sh @@ -1,6 +1,6 @@ #!/usr/bin/bash set -e -source /teuthology/virtualenv/bin/activate +PATH=$PATH:/teuthology/.venv/bin set -x cat /run/secrets/id_rsa > $HOME/.ssh/id_rsa if [ -n "$TEUTHOLOGY_TESTNODES" ]; then diff --git a/docs/docker-compose/teuthology/teuthology.sh b/docs/docker-compose/teuthology/teuthology.sh index 78770e323..c9ed897e2 100755 --- a/docs/docker-compose/teuthology/teuthology.sh +++ b/docs/docker-compose/teuthology/teuthology.sh @@ -4,7 +4,7 @@ set -e if [ -n "$SSH_PRIVKEY_FILE" ]; then echo "$SSH_PRIVKEY" > $HOME/.ssh/$SSH_PRIVKEY_FILE fi -source /teuthology/virtualenv/bin/activate +PATH=$PATH:/teuthology/.venv/bin set -x if [ -n "$TESTNODES" ]; then for node in $(echo $TESTNODES | tr , ' '); do diff --git a/teuthology/dispatcher/__init__.py b/teuthology/dispatcher/__init__.py index 59f8ae327..f64246f2a 100644 --- a/teuthology/dispatcher/__init__.py +++ b/teuthology/dispatcher/__init__.py @@ -304,7 +304,7 @@ def prep_job(job_config, log_file_path, archive_dir): ) raise SkipJob() - teuth_bin_path = os.path.join(teuth_path, 'virtualenv', 'bin') + teuth_bin_path = os.path.join(teuth_path, '.venv', 'bin') if not os.path.isdir(teuth_bin_path): raise RuntimeError("teuthology branch %s at %s not bootstrapped!" % (teuthology_branch, teuth_bin_path)) diff --git a/teuthology/dispatcher/test/test_dispatcher.py b/teuthology/dispatcher/test/test_dispatcher.py index 58f58cf9c..4b15e3537 100644 --- a/teuthology/dispatcher/test/test_dispatcher.py +++ b/teuthology/dispatcher/test/test_dispatcher.py @@ -71,7 +71,7 @@ class TestDispatcher(object): ) assert got_config['teuthology_branch'] == 'main' m_fetch_teuthology.assert_called_once_with(branch='main', commit='teuth_hash') - assert teuth_bin_path == '/teuth/path/virtualenv/bin' + assert teuth_bin_path == '/teuth/path/.venv/bin' m_fetch_qa_suite.assert_called_once_with('main', 'suite_hash') assert got_config['suite_path'] == '/suite/path' diff --git a/teuthology/repo_utils.py b/teuthology/repo_utils.py index db6e87a8c..bb959b5c2 100644 --- a/teuthology/repo_utils.py +++ b/teuthology/repo_utils.py @@ -464,7 +464,7 @@ def bootstrap_teuthology(dest_path): if returncode != 0: for line in out.split("\n"): log.warning(line.strip()) - venv_path = os.path.join(dest_path, 'virtualenv') + venv_path = os.path.join(dest_path, '.venv') log.info("Removing %s", venv_path) shutil.rmtree(venv_path, ignore_errors=True) raise BootstrapError("Bootstrap failed!") -- 2.47.3