Skip to content

Commit fee1894

Browse files
authored
chore: preserve .repo-metadata.json (#14326)
This PR fixes the following error when running librarian locally ``` 2025/08/29 23:26:15 ERROR failed to generate library id=google-cloud-language err="failed to copy google-cloud-language to /usr/local/google/home/partheniou/git/google-cloud-python/packages/google-cloud-language: open .repo-metadata.json: permission denied" 2025/08/29 23:26:15 all 1 libraries failed to generate ```
1 parent 25504f3 commit fee1894

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

.generator/cli.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,10 @@ def _clean_up_files_after_post_processing(output: str, library_id: str):
302302
Path(f"{output}/{path_to_library}/docs/CHANGELOG.md").unlink(missing_ok=True)
303303
Path(f"{output}/{path_to_library}/docs/README.rst").unlink(missing_ok=True)
304304

305+
# Remove `.repo-metadata.json` file to avoid ownership issues between
306+
# the container and librarian. Instead, preserve this file in the destination.
307+
Path(f"{output}/{path_to_library}/.repo-metadata.json").unlink(missing_ok=True)
308+
305309
# The glob loops are already safe, as they do nothing if no files match.
306310
for post_processing_file in glob.glob(
307311
f"{output}/{path_to_library}/scripts/client-post-processing/*.yaml"

.librarian/state.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ libraries:
1111
- packages/google-cloud-language
1212
preserve_regex:
1313
- .OwlBot.yaml
14+
- .repo-metadata.json
1415
- packages/google-cloud-language/CHANGELOG.md
1516
- docs/CHANGELOG.md
1617
- docs/README.rst

0 commit comments

Comments
 (0)