Commit 4d64ebc
authored
ci: pre-populate synthtool cache to avoid race condition (#17230)
This PR resolves a blocking parallel generation issue on GitHub Actions
and updates Spanner's post-processing config to align with recent
template updates.
### 1. Fix GHA parallel generation race condition
When running `librarian generate --all` in GHA, multiple libraries are
generated in parallel. They concurrently invoke `synthtool`, which races
to clone/update the templates repository (`googleapis/synthtool`) in the
shared cache directory `~/.cache/synthtool/synthtool`.
This results in either:
* A **clone race**: One process starts cloning, and others see the
half-created directory, assume it's valid, and fail with `fatal: failed
to resolve HEAD as a valid ref` when running `git branch`.
* An **update race**: Multiple processes try to run `git checkout` /
`git pull` concurrently, failing with `fatal: Unable to create ...
index.lock: File exists`.
**Fix**:
We now clone `googleapis/synthtool` once sequentially at the beginning
of the workflow (`Clone Synthtool Templates`), and configure
`SYNTHTOOL_TEMPLATES` environment variable globally to point to this
local directory. This completely bypasses all concurrent git clone/pull
operations during parallel generation, resolving the race conditions and
speeding up the build.
### 2. Fix Spanner post-processing AssertionError
We removed the obsolete `Supported Python Versions` replacement block
from
`.librarian/generator-input/client-post-processing/spanner-integration.yaml`.
**Why it was needed**:
* On **May 19, 2026** (commit `2408166fec`), Python 3.7-3.9 support was
dropped specifically for Spanner. Because the `synthtool` templates
still generated `Python >= 3.9` in `README.rst` by default, a
post-processing workaround was added to force it to `3.10`.
* On **May 21, 2026** (commit `e643ce8` in `googleapis/synthtool`),
`synthtool` templates were updated globally to drop Python 3.9 support
for all mono-repo libraries.
* As a result, the freshly generated `README.rst` for Spanner now
already defaults to `Python >= 3.10`. The May 19 workaround became
obsolete and failed with `AssertionError: Replaced 0 rather than 1
instances` because the "before" pattern (expecting `3.9`) no longer
exists.
TAG=agy
CONV=acb0ee9b-3d87-4b9e-b3c6-0d4aa3efbd351 parent 357c62e commit 4d64ebc
2 files changed
Lines changed: 5 additions & 31 deletions
File tree
- .github/workflows
- .librarian/generator-input/client-post-processing
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
| |||
Lines changed: 0 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
607 | 607 | | |
608 | 608 | | |
609 | 609 | | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | | - | |
614 | | - | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | 610 | | |
624 | | - | |
625 | | - | |
626 | | - | |
627 | | - | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | 611 | | |
643 | 612 | | |
644 | 613 | | |
| |||
0 commit comments