Regenerating the gRPC stubs¶
shakenfist/protos/ holds generated protobuf and gRPC code which is checked
in. Every *_pb2_grpc.py records the grpcio-tools version that wrote it in
GRPC_GENERATED_VERSION, and
shakenfist/tests/test_generated_proto_stubs.py fails when that disagrees
with the grpcio-tools pin in pyproject.toml. A change to a pin therefore
has to arrive together with regenerated stubs.
By hand¶
and commit all of the result, not only the families your change touched. Use
this whenever you edit a .proto file.
On a Renovate bump¶
renovate.json groups grpcio, grpcio-tools, protobuf and the packages
whose names contain them (mypy-protobuf, types-protobuf) into one pull
request, and gives that rule a postUpgradeTasks entry which runs
tools/regen-grpc-stubs.sh once per branch after the pins are rewritten.
The regenerated files are committed to the Renovate branch, so the bump
arrives with the stubs already consistent.
tools/regen-grpc-stubs.sh is the same generation as tox -e genprotos
(it runs protos/_make_stubs.sh with the pinned generator versions), but
builds a venv of only grpcio, grpcio-tools, protobuf and
mypy-protobuf rather than installing Shaken Fist and its test extras. The
Renovate runner is a bare Debian VM without the system libraries a full
install needs. The script and tox -e genprotos should leave identical
trees; if they ever do not, that is a bug in the script.
Runner requirement¶
Renovate only runs a post-upgrade command which the runner's global
configuration allows. Renovate here is the central self-hosted runner in
shakenfist/development (.github/workflows/renovate-fleet.yml, global
config renovate-runner.json), and that file must list the command:
If it does not, Renovate does not skip the task quietly: it adds an
"artifact update problem" to the pull request naming the command which is
not on the allowed list, and the pull request then fails the stub test as it
did before this existed. In that case, run tox -e genprotos on the branch
and push, as before.
The command runs from the pull request's own checkout, so it executes repository code on the runner VM. That is the same trust the repository already has in its own CI, and the runner VM is ephemeral.