Commit a3d2344
authored
chore(librarian): exclude version files under tests directory (#14862)
This PR fixes an issue where `librarian release stage` fails for
libraries when version files exist under test directories and are not
expected to be updated. See the following stack trace for
`gapic-generator-python` when running `librarian release stage`.
```
partheniou@partheniou-vm-3:~/git/gapic-generator-python$ librarian release stage
time=2025-11-08T14:22:44.752Z level=INFO msg="temporary working directory" dir=/tmp/librarian-1630479680
time=2025-11-08T14:22:44.752Z level=INFO msg="repo not specified, using current working directory as repo root" path=/usr/local/google/home/partheniou/git/gapic-generator-python
time=2025-11-08T14:22:44.752Z level=INFO msg="opening repository" dir=/usr/local/google/home/partheniou/git/gapic-generator-python
time=2025-11-08T14:22:44.956Z level=INFO msg="source not specified, skipping service config population"
time=2025-11-08T14:22:44.956Z level=INFO msg="config.yaml not found, proceeding"
time=2025-11-08T14:22:44.957Z level=INFO msg="staging a release" dir=/tmp/librarian-1630479680/output
time=2025-11-08T14:22:44.973Z level=INFO msg="updating library to the next version" library=gapic-generator currentVersion=1.29.0 nextVersion=1.30.0
time=2025-11-08T14:22:44.974Z level=INFO msg="=== Docker start ==============================================================="
time=2025-11-08T14:22:44.974Z level=INFO msg="/usr/bin/docker run --rm -v /usr/local/google/home/partheniou/git/gapic-generator-python/.librarian:/librarian -v /usr/local/google/home/partheniou/git/gapic-generator-python:/repo:ro -v /tmp/librarian-1630479680/output:/output --user 814163:89939 us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator:latest release-stage --librarian=/librarian --repo=/repo --output=/output"
time=2025-11-08T14:22:44.974Z level=INFO msg=--------------------------------------------------------------------------------
2025-11-08 14:22:45,791 synthtool [CRITICAL] > You are running the synthesis script directly, this will be disabled in a future release of Synthtool. Please use python3 -m synthtool instead.
2025-11-08 14:22:45,990 synthtool [DEBUG] > Using local templates at /synthtool/synthtool/gcp/templates
2025-11-08 14:22:45,997 synthtool [DEBUG] > Using local templates at /synthtool/synthtool/gcp/templates
Traceback (most recent call last):
File "/app/./cli.py", line 1497, in handle_release_stage
_update_version_for_library(repo, output, path_to_library, version)
~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/./cli.py", line 1251, in _update_version_for_library
_write_json_file(output_path, metadata_contents)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/./cli.py", line 114, in _write_json_file
with open(path, "w") as f:
~~~~^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/output/tests/integration/goldens/redis_selective/samples/generated_samples/snippet_metadata_google.cloud.redis.v1.json'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/./cli.py", line 1592, in <module>
args.func(librarian=args.librarian, repo=args.repo, output=args.output)
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/./cli.py", line 1509, in handle_release_stage
raise ValueError(f"Release stage failed: {e}") from e
ValueError: Release stage failed: [Errno 13] Permission denied: '/output/tests/integration/goldens/redis_selective/samples/generated_samples/snippet_metadata_google.cloud.redis.v1.json'
time=2025-11-08T14:22:46.419Z level=INFO msg="=== Docker end ================================================================="
time=2025-11-08T14:22:46.419Z level=ERROR msg="librarian command failed" err="exit status 1"
```1 parent 3c265a4 commit a3d2344
2 files changed
+18
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1199 | 1199 | | |
1200 | 1200 | | |
1201 | 1201 | | |
1202 | | - | |
| 1202 | + | |
| 1203 | + | |
1203 | 1204 | | |
1204 | 1205 | | |
1205 | 1206 | | |
| |||
1209 | 1210 | | |
1210 | 1211 | | |
1211 | 1212 | | |
| 1213 | + | |
1212 | 1214 | | |
1213 | | - | |
1214 | | - | |
1215 | | - | |
1216 | | - | |
1217 | | - | |
1218 | | - | |
1219 | | - | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
1220 | 1223 | | |
1221 | 1224 | | |
1222 | 1225 | | |
| |||
1238 | 1241 | | |
1239 | 1242 | | |
1240 | 1243 | | |
1241 | | - | |
1242 | | - | |
| 1244 | + | |
| 1245 | + | |
1243 | 1246 | | |
1244 | 1247 | | |
1245 | 1248 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1037 | 1037 | | |
1038 | 1038 | | |
1039 | 1039 | | |
1040 | | - | |
| 1040 | + | |
1041 | 1041 | | |
1042 | 1042 | | |
1043 | 1043 | | |
1044 | | - | |
1045 | | - | |
| 1044 | + | |
| 1045 | + | |
1046 | 1046 | | |
1047 | 1047 | | |
1048 | 1048 | | |
1049 | 1049 | | |
1050 | 1050 | | |
1051 | | - | |
| 1051 | + | |
| 1052 | + | |
1052 | 1053 | | |
1053 | 1054 | | |
1054 | 1055 | | |
| |||
0 commit comments