Skip to content

fix: make build --no-cache and start --rebuild work - #13

Open
TheDreamSaver wants to merge 1 commit into
SilosLabs:mainfrom
TheDreamSaver:fix/build-no-cache-start-rebuild
Open

TheDreamSaver wants to merge 1 commit into
SilosLabs:mainfrom
TheDreamSaver:fix/build-no-cache-start-rebuild

Conversation

@TheDreamSaver

Copy link
Copy Markdown
Member

Fixes #12

What

  • silo build --no-cache: runBuild now reads Commander's cache option (BuildOptions.noCache → cache?: boolean, and the cli.ts action type to match). The three duplicated ...(opts.noCache ? ["--no-cache"] : []) call sites now share a small exported noCacheArgs(cache) helper.
  • silo start --rebuild: runStart now calls runBuild({ framework, browser }) after the "already running" check and before the image is resolved. runBuild tags the configured sandbox image, or frameworkImageTag(id, { browser }) for framework runs, which is exactly the image start then uses, so no tag needs to be passed through.
  • quickstart: dropped noCache: false from its runBuild call. That's the default now, so behaviour is unchanged. Typecheck caught this one.
  • New tests/commands/build.test.ts: covers noCacheArgs.

Testing

  • npm run typecheck: passes.
  • npm test: 24 files, 341 tests pass (2 new).
  • npm run build: succeeds.
  • End to end with a fake docker on PATH (logs its args; info → 0, inspect → 1, build → configurable) and a throwaway HOME:
Command main this branch
silo build build --tag silo-sandbox:latest same
silo build --no-cache build --tag silo-sandbox:latest (flag dropped) build --tag silo-sandbox:latest --no-cache
silo start --rebuild no build; goes straight to network build --tag silo-sandbox:latest first
silo start no build no build
  • Checked against fix: read the CLI version from package.json #11, which is also open: the two branches only overlap in src/cli.ts, in separate hunks. A trial merge is clean in either order, and the combined result typechecks and passes all 343 tests.

Commander stores the negatable `--no-cache` option as `cache: false`, but
runBuild read `opts.noCache`, which was always undefined, so docker never
received --no-cache. `start --rebuild` was declared but never read.

Read `cache` (via a shared noCacheArgs helper for the three docker build
call sites), and have `start --rebuild` call runBuild with the same
framework/browser selection before the image is resolved.

Fixes SilosLabs#12
@Asdivyansh

Copy link
Copy Markdown
Member

Need to verify, looking into it.

@TheDreamSaver

Copy link
Copy Markdown
Member Author

@Asdivyansh, a friendly bump on this one. It still merges cleanly with current main: merged locally on top of #18 and #20, it typechecks and all 354 tests pass.

If it helps with verifying, here's the quickest check with Docker running:

  1. silo build --no-cache should rebuild every layer, with no CACHED steps in the output. On main the flag is dropped, so you'll see cached layers.
  2. silo start --rebuild, with the sandbox stopped, should run a build before starting. On main it skips straight to starting.

Happy to rebase or change anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

silo build --no-cache and silo start --rebuild have no effect

2 participants