docker: make `DOCKER_ARMBIAN_BASE_IMAGE` readonly after resolving `DOCKER_ARMBIAN_BASE_COORDINATE_PREFIX`
- otherwise stuff (eg extensions) might be tempted to change it, but that will only lead to pain
Summary by CodeRabbit
-
Refactor
- Improved code stability by implementing stricter controls on Docker configuration variable assignments.
Walkthrough
The DOCKER_ARMBIAN_BASE_IMAGE variable is declared as readonly after its value is assigned in the docker_cli_prepare function, preventing subsequent modifications. This adds a protective declaration to an existing variable with no logic or error handling changes.
Changes
| Cohort / File(s) | Change Summary |
|---|---|
Variable immutability enforcement lib/functions/host/docker.sh |
Added readonly declaration for DOCKER_ARMBIAN_BASE_IMAGE after assignment to prevent accidental or unauthorized modifications. |
Estimated code review effort
🎯 1 (Trivial) | ⏱️ ~3 minutes
- Single-line addition of a readonly declaration
- No logic modifications or control flow changes
- Straightforward to verify correct placement after variable assignment
Poem
A variable so precious, now locked with care, No wandering values, no unguarded dare,
readonlystands guard, a sentinel so keen, The safestDOCKER_ARMBIAN_BASE_IMAGEever seen! 🐰✨
Pre-merge checks and finishing touches
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check | ✅ Passed | The title accurately and specifically describes the main change: making DOCKER_ARMBIAN_BASE_IMAGE readonly after resolving DOCKER_ARMBIAN_BASE_COORDINATE_PREFIX. |
✨ Finishing touches
- [ ] 📝 Generate docstrings
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
Comment @coderabbitai help to get the list of available commands and usage tips.
This whole thread with the rabbit hallucinating is pointless.
The reality is that (as the docs detail) extensions should only contain functions and not set variables. During Docker launch (and Dockerfile build), extensions are enabled. The choice of variable name/reuse was bad, and it allows extensions to corrupt the flow if they set the var outside of a function.
Unfortunately there's no way we can enforce that extensions won't do changes to global vars out of function context.
Boards/extensions are not supposed to be able to change the Docker base image; that's supposed to happen only at matrix generation time (and thus passed via command-line), or using a config file.