Uh oh!
There was an error while loading. Please reload this page.
fix(ci): wait for postCreateCommand before running the command - #774
Conversation
devsy ci ran the user command immediately after RunHeadless returned, without waiting for deferred lifecycle hooks (postCreateCommand) to finish. With the default waitFor=updateContentCommand, postCreate runs in a detached background process, so the command could execute before the container was fully provisioned (e.g. secrets injected by a postCreateCommand were missing). ci now floors the effective waitFor at postCreateCommand so provisioning hooks run synchronously. The floor never lowers a later waitFor a user configured, per the devcontainer spec. postStartCommand stays deferred to avoid blocking ci on long-running start commands. Collapse RunPreAttachHooks parameters into a PreAttachOptions struct.
✅ Deploy Preview for images-devsy-sh canceled.
|
✅ Deploy Preview for devsydev canceled.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThe change adds ChangesLifecycle wait phase propagation
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Uh oh!
There was an error while loading. Please reload this page.
Summary
devsy cicould run the user command before the container was fully provisioned. It executed the command immediately afterRunHeadlessreturned, but with the devcontainer defaultwaitFor=updateContentCommand,postCreateCommandruns in a detached, unawaited background process — so the command raced that process. Symptom: apostCreateCommandthat writes state (e.g. injecting a secret from--secrets-file) hadn't run yet, so the command saw missing files/data.Fix
cinow floors the effectivewaitForatpostCreateCommand, so provisioning hooks run synchronously before the run command. Sinceciis a batch operation with no interactive attach, there's no reason to defer hooks (deferral exists to makedevsy upattach fast).Key details:
waitFora user explicitly configured (e.g.postStartCommand/postAttachCommand), mirroring the existingpromoteDotfilesWaitForbehavior.postCreateCommand, notpostStartCommand—postStartCommandstays deferred so a long-running/blocking start command can't hangci.upis unchanged — the override is empty forup, so its fast-attach deferral behavior is preserved.RunPreAttachHooks's parameters into aPreAttachOptionsstruct (also brings it back underrevive'sargument-limit) and uses the typedLifecyclePhaseend-to-end.Tests
Existing lifecycle-hook tests updated for the new signature; added
TestResolveWaitForFloorcovering floor semantics (raise, never lower;initializeCommandpromoted topostCreate; empty/invalid floor ignored). Builds on Linux + Windows;go vetandgolangci-lintclean.Summary by CodeRabbit
New Features
waitForphase.Refactor
Tests