fix: mount .git folder to itk for local runs#940
Conversation
There was a problem hiding this comment.
Code Review
This pull request modifies the itk/run_itk.sh script to automate the A2A_SAMPLES_REVISION assignment and mount the .git directory into the Docker container. The review identifies a logic error in the REPO_ROOT path calculation and suggests a more robust method for parsing the revision string from the YAML file to handle quotes and comments.
| # Mounting a2a-python as repo and itk as current agent | ||
| A2A_PYTHON_ROOT=$(cd .. && pwd) | ||
| ITK_DIR=$(pwd) | ||
| REPO_ROOT=$(cd ../.. && pwd) |
There was a problem hiding this comment.
REPO_ROOT is calculated as ../../, which points to the directory above the repository root (since itk/run_itk.sh is located in the itk/ subdirectory). The .git directory is typically located at the repository root, which is already captured by A2A_PYTHON_ROOT (../). Using ../../ will likely result in a non-existent or incorrect .git path being mounted.
| REPO_ROOT=$(cd ../.. && pwd) | |
| REPO_ROOT=$A2A_PYTHON_ROOT |
|
|
||
| # 1. Pull a2a-samples and checkout revision | ||
| : "${A2A_SAMPLES_REVISION:?A2A_SAMPLES_REVISION environment variable must be set}" | ||
| : "${A2A_SAMPLES_REVISION:=$(grep "A2A_SAMPLES_REVISION:" ../.github/workflows/itk.yaml | head -n 1 | awk '{print $2}')}" |
There was a problem hiding this comment.
The extraction of A2A_SAMPLES_REVISION from the YAML file might include surrounding quotes (e.g., "v1.0.0") if they are present in the workflow file. This would cause the git checkout command on line 31 to fail. It is safer to strip any quotes from the extracted value. Additionally, using a more specific regex prevents matching commented-out lines.
| : "${A2A_SAMPLES_REVISION:=$(grep "A2A_SAMPLES_REVISION:" ../.github/workflows/itk.yaml | head -n 1 | awk '{print $2}')}" | |
| : "${A2A_SAMPLES_REVISION:=$(grep \"^ *A2A_SAMPLES_REVISION:\" ../.github/workflows/itk.yaml | head -n 1 | awk '{print $2}' | tr -d '\"' | tr -d \"'\")}" |
🧪 Code Coverage (vs
|
c5c68f0 to
0d474a0
Compare
0d474a0 to
92784a9
Compare
Description
.git folder needs to be mounted in order to recognize git project for local runs
CONTRIBUTINGGuide.fix:which represents bug fixes, and correlates to a SemVer patch.feat:represents a new feature, and correlates to a SemVer minor.feat!:, orfix!:,refactor!:, etc., which represent a breaking change (indicated by the!) and will result in a SemVer major.bash scripts/format.shfrom the repository root to format)Fixes #<issue_number_goes_here> 🦕