Deploy: Implement internet connectivity checks#954
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an internet-connectivity probe to the deployment tooling so Pixi commands on robots can avoid failing when a default gateway exists but no real internet route is available. It centralizes Pixi command construction (including conditional --as-is) and updates deploy tasks to use the new helper.
Changes:
- Introduce
deploy/pixi.pywithrobot_has_internet()caching,pixi_run_command(),pixi_install_if_online(), and a parallelrun_for_connections()helper. - Update deploy tasks (
sync,launch,build,configure) to use the new Pixi helpers for consistent offline behavior. - Add unit tests for the Pixi connectivity/command behavior.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| scripts/deploy/pixi.py | New shared helpers for connectivity probing, offline-safe Pixi commands, and parallel execution. |
| scripts/deploy/tasks/sync.py | Replaces unconditional pixi install verification with conditional pixi_install_if_online(). |
| scripts/deploy/tasks/launch.py | Switches Pixi invocations to pixi_run_command() and uses run_for_connections() for execution. |
| scripts/deploy/tasks/build.py | Uses pixi_run_command() + run_for_connections() for clean/build steps. |
| scripts/deploy/tasks/configure.py | Routes Pixi execution through pixi_run_command() and clears cached internet status after wifi priority changes. |
| scripts/deploy/tests/test_pixi.py | Adds tests covering offline/online command selection and connectivity caching. |
| scripts/deploy/init.py | Marks deploy as a Python package for importability. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| from deploy import pixi # noqa: E402 | ||
|
|
||
| _PIXI_REPOSITORY_CHECK_COMMAND = "curl -sSfLI --max-time 2 https://data.bit-bots.de/conda-misc/output/" |
|
Is there no other way around this? This seems very risky, as it is not refusing do build without an up to date environment. I am totally for being able to override this behavior, but I have the concern that this leads to outdated/diverging robot env and weird behavior really quickly. I also don't understand why it wants internet access for an up to date lock file? |
|
Maybe the frozen flag is more appropriate. Imo we should always use --frozen on the robot when using the deployment. If the lock file is out of date we need to regenerate it on the host. |
Update Options:
--no-install
Don't modify the environment, only modify the lock file
[env: PIXI_NO_INSTALL=]
--frozen
Install the environment as defined in the lock file, doesn't update lock file if it isn't up-to-date with the manifest file
[env: PIXI_FROZEN=]
--locked
Check if lock file is up-to-date before installing the environment, aborts when lock file isn't up-to-date with the manifest file
[env: PIXI_LOCKED=]
--as-is
Shorthand for the combination of --no-install and --frozenWe assume, pixi errors "correctly" when the lock doesn't match the env and requires updates |
|
|
That you should be able to e.g. manually override using as-is if you are sure that nothing significantly changed. |
|
Maybe we also need locked. |
You want an argument to do the normal install behavior without |
No. I mean I think as-is is okay to have as long as it is not the default and used with caution. |
|
After talking with Jan we came to the conclusion that we probably want to have --frozen and --locked always on the robot by default. --no-install is the one that's dangerous imo and --as-is combines --frozen and --no-install. Why pixie tries to regenerate the lock file is a different story and I suspect it may be related to the way bitbots_rust_nav is compiled. Sometimes the hash of the build changes for whatever reason triggering a rebuilt and update of the lock file. There is a way around this by building it with colcon, which is cleaner imo. that is pr #X with bitbots_cargo, which works on my machine, but had some llvm compatibility error on Cornelius one. |
Summary
curl -sSfLI --max-time 5 https://data.bit-bots.de/conda-misc/output/)pixi installas normalpixiwith--as-isto prevent install failuresWhy? We now have a default gateway configured on the robots.
Thus, pixi thinks, we should have an internet connection and tries to sync/install on every command and fails, if there is no true internet connection.
Proposed changes
Related issues
Checklist
pixi run build