Repository navigation
Initialize the cache in the compile test the way a real run does - #167
Merged
Merged
Conversation
Passing a command bypasses the image entrypoint, so cache.sh never ran and the compile relied on each tool creating its own tree under the world-writable mount. That works today but is incidental, tests a path no user takes, and left cache.sh exercised by nothing.
There was a problem hiding this comment.
Pull request overview
This PR improves the fidelity of the compile-test workflow by initializing /cache the same way a real container start does, ensuring the cache directory layout (including HOME=/cache/home) is created and that the cache-initialization script is exercised during CI.
Changes:
- Run
/entrypoint/cache.shat the start of the compile-test script before validating/compiling the fixture configs. - Document the rationale and behavior change in
WORKFLOW.md(cache init + coverage ofentrypoint/cache.sh).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| WORKFLOW.md | Updates the compile-test documentation to describe cache initialization via /entrypoint/cache.sh and the added coverage. |
| .github/workflows/validate-task.yml | Adds a pre-step in the generated compile.sh to run /entrypoint/cache.sh before running esphome config/esphome compile. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The compile test runs
bash /config/compile.sh, which takes the image entrypoint'sexec "$@"branch, soentrypoint/cache.shnever runs and/cache/{pio,build,data,pip,home}are never created - includingHOME.Raised by the Copilot review on promotion #163.
What the review predicted, and what actually happens
The review expected the run to fail on a fresh cache mount. It does not, and that was checked rather than assumed: with a genuinely empty
/cache,HOME=/cache/homeand/cache/builddo not exist andesphome configstill succeeds. Every compile run so far, local and in CI, started from an empty cache and passed. The tools create their own trees because the mount is world-writable.So the predicted failure is not real. The underlying observation is, and the change is worth making for three other reasons:
entrypoint/cache.shis currently exercised by no test at all. This puts it under one.Verification
cache.shruns cleanly as uid 1000 and creates all five directories.Creating cache directories/Clearing temporary files/Pruning PIO cacheall execute, then the fixture compiles. Real exit code 0.Note
Blocks promotion #163, which picks this up once merged.