Codium-ai / pr-agent

🚀CodiumAI PR-Agent: An AI-Powered 🤖 Tool for Automated Pull Request Analysis, Feedback, Suggestions and More! 💻🔍
Apache License 2.0
5.62k stars 518 forks source link

Azure Devops Exception when not using ADO #1143

Open MarkRx opened 1 month ago

MarkRx commented 1 month ago

In a locked down container environment (a security practice where all files are read only within a container and only volumes can be written to) a server fails to boot due to an ADO error even when not using ADO. It appears to be because ADO attempts to write ./azure-devops on during initialization.

line

Fix could be to enhance the delayed exception handling to handle any exception then rethrow it here

traceback (most recent call last): File "/app/pr_agent/servers/bitbucket_server_webhook.py", line 15, in from pr_agent.agent.pr_agent import PRAgent File "/app/pr_agent/agent/pr_agent.py", line 10, in from pr_agent.git_providers.utils import apply_repo_settings File "/app/pr_agent/git_providers/init.py", line 9, in from pr_agent.git_providers.azuredevops_provider import AzureDevopsProvider File "/app/pr_agent/git_providers/azuredevops_provider.py", line 21, in from azure.devops.connection import Connection File "/usr/local/lib/python3.11/site-packages/azure/devops/connection.py", line 9, in from ._file_cache import RESOURCE_CACHE as RESOURCE_FILE_CACHE File "/usr/local/lib/python3.11/site-packages/azure/devops/_file_cache.py", line 128, in DEFAULT_CACHE_DIR = get_cache_dir() ^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/azure/devops/_file_cache.py", line 118, in get_cache_dir os.makedirs(azure_devops_cache_dir) File "", line 215, in makedirs File "", line 215, in makedirs File "", line 225, in makedirs PermissionError: [Errno 13] Permission denied: '/.azure-devops'

MarkRx commented 1 month ago

Looks like I can workaround this by setting AZURE_DEVOPS_CACHE_DIR to a bogus volume that the execution user has write access to. code

mrT23 commented 3 weeks ago

ok.

you are welcome to open a PR to update the documentation with this trick if you think its necessary https://pr-agent-docs.codium.ai/installation/azure/#azure-devops-webhook