@spunto/build 0.26.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/naming/index.ts +15 -0
- package/src/script/setup-script.ts +84 -92
- package/src/spec/index.ts +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spunto/build",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Spunto's shared Build engine — the devcontainer image protocol and VS Code extension registry clients, with no database, no HTTP framework and no UI.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/src/naming/index.ts
CHANGED
|
@@ -113,6 +113,21 @@ export const FEATURE_ENTRYPOINTS_FILE = "/etc/mp-feature-entrypoints"
|
|
|
113
113
|
*/
|
|
114
114
|
export const FEATURE_ENTRYPOINTS_STAGING_FILE = "/tmp/mp-feature-entrypoints"
|
|
115
115
|
|
|
116
|
+
/**
|
|
117
|
+
* The lifecycle commands features declare (devcontainer spec: `onCreateCommand`,
|
|
118
|
+
* `postCreateCommand`, `postStartCommand` in a devcontainer-feature.json), one file per hook named
|
|
119
|
+
* after it, one command per line in install order. The image build writes them; the setup runs
|
|
120
|
+
* them before the project's own (`postCreateCommand` once, `postStartCommand` at every start) — how
|
|
121
|
+
* docker-in-docker waits for its daemon without the setup knowing anything about Docker.
|
|
122
|
+
*/
|
|
123
|
+
export const FEATURE_HOOKS_DIR = "/etc/mp-feature-hooks"
|
|
124
|
+
|
|
125
|
+
/** Where the hooks of each feature are accumulated during the build, like the entrypoints. */
|
|
126
|
+
export const FEATURE_HOOKS_STAGING_DIR = "/tmp/mp-feature-hooks"
|
|
127
|
+
|
|
128
|
+
/** The feature lifecycle hooks the setup runs, in the order the spec runs them. */
|
|
129
|
+
export const FEATURE_HOOKS = ["onCreateCommand", "postCreateCommand", "postStartCommand"] as const
|
|
130
|
+
|
|
116
131
|
/**
|
|
117
132
|
* Extensions the image build could not install, one id per line. Left in the image so a worker can
|
|
118
133
|
* tell what is missing without anyone re-reading the build log — see `EXTENSION_FAILED_MARKER` in
|
|
@@ -4,6 +4,9 @@ import {
|
|
|
4
4
|
EXTENSIONS_DIR,
|
|
5
5
|
FEATURE_ENTRYPOINTS_FILE,
|
|
6
6
|
FEATURE_ENTRYPOINTS_STAGING_FILE,
|
|
7
|
+
FEATURE_HOOKS,
|
|
8
|
+
FEATURE_HOOKS_DIR,
|
|
9
|
+
FEATURE_HOOKS_STAGING_DIR,
|
|
7
10
|
workerStatusPath,
|
|
8
11
|
} from "../naming/index"
|
|
9
12
|
import { stepEndLine, stepStartLine, type BuildStep, type BuildStepKind } from "../steps/build-steps"
|
|
@@ -380,6 +383,28 @@ function mkStatus(
|
|
|
380
383
|
return JSON.stringify({ phase, repos, postCreate, postStart } satisfies SetupStatus)
|
|
381
384
|
}
|
|
382
385
|
|
|
386
|
+
/**
|
|
387
|
+
* Run the lifecycle commands the features declared for `hook` (FEATURE_HOOKS_DIR, written by the
|
|
388
|
+
* image build), in install order, as the user, from /workspace — before the project's own. One that
|
|
389
|
+
* fails is said and the next runs: a feature's hook is a courtesy (docker-in-docker waiting for its
|
|
390
|
+
* daemon), not the project's command, and a box set up without it is better than no box.
|
|
391
|
+
* stdin from /dev/null: `su` would otherwise read the rest of the list as its input.
|
|
392
|
+
*/
|
|
393
|
+
function featureHookLines(hook: (typeof FEATURE_HOOKS)[number], username: string): string[] {
|
|
394
|
+
const file = `${FEATURE_HOOKS_DIR}/${hook}`
|
|
395
|
+
return [
|
|
396
|
+
"",
|
|
397
|
+
`if [ -s ${file} ]; then`,
|
|
398
|
+
` echo "--- Running the features' ${hook} ---"`,
|
|
399
|
+
" while IFS= read -r _hc; do",
|
|
400
|
+
' [ -n "$_hc" ] || continue',
|
|
401
|
+
' echo "Running: $_hc"',
|
|
402
|
+
` su ${username} -c "cd /workspace && $_hc" < /dev/null 2>&1 || echo " (exited $?, continuing)"`,
|
|
403
|
+
` done < ${file}`,
|
|
404
|
+
"fi",
|
|
405
|
+
]
|
|
406
|
+
}
|
|
407
|
+
|
|
383
408
|
function banner(title: string): string[] {
|
|
384
409
|
return [
|
|
385
410
|
"",
|
|
@@ -431,6 +456,17 @@ function buildFeatureInstallScript(ociRef: string, options?: Record<string, stri
|
|
|
431
456
|
` echo "$_EP" >> ${FEATURE_ENTRYPOINTS_STAGING_FILE}`,
|
|
432
457
|
` echo "[feature] ${featureId}: registered entrypoint $_EP"`,
|
|
433
458
|
` fi`,
|
|
459
|
+
// Its lifecycle hooks, in their string form — the array and object forms are said and skipped
|
|
460
|
+
// (read with grep, like the entrypoint: no JSON tool is guaranteed in the image being built).
|
|
461
|
+
` for _h in ${FEATURE_HOOKS.join(" ")}; do`,
|
|
462
|
+
` _HC=$(grep -o "\\"$_h\\"[[:space:]]*:[[:space:]]*\\"[^\\"]*\\"" "$_FEAT_DIR/devcontainer-feature.json" | head -1 | cut -d'"' -f4)`,
|
|
463
|
+
` if [ -n "$_HC" ]; then`,
|
|
464
|
+
` mkdir -p ${FEATURE_HOOKS_STAGING_DIR} && echo "$_HC" >> "${FEATURE_HOOKS_STAGING_DIR}/$_h"`,
|
|
465
|
+
` echo "[feature] ${featureId}: registered $_h $_HC"`,
|
|
466
|
+
` elif grep -q "\\"$_h\\"[[:space:]]*:[[:space:]]*[[{]" "$_FEAT_DIR/devcontainer-feature.json"; then`,
|
|
467
|
+
` echo "[feature] ${featureId}: $_h ignored — only its string form is run"`,
|
|
468
|
+
` fi`,
|
|
469
|
+
` done`,
|
|
434
470
|
`fi`,
|
|
435
471
|
`cd /`,
|
|
436
472
|
`rm -rf "$_FEAT_DIR"`,
|
|
@@ -710,16 +746,15 @@ export function defaultVscodeUserSettings(opts?: {
|
|
|
710
746
|
* 3 → spunto-pack 1.1: the IDE wears Spunto's name, icons and themes (coderhammer/features).
|
|
711
747
|
* 4 → the IDE out of the pack (`codeServerInPack: false`): code-server comes from `spunto-ide`,
|
|
712
748
|
* the feature of an IDE app, and only in the image of a project that has one (RFC 0059).
|
|
749
|
+
* 5 → the features' lifecycle hooks are kept in the image (FEATURE_HOOKS_DIR) for the setup to run.
|
|
713
750
|
*/
|
|
714
|
-
export const IMAGE_RECIPE_VERSION =
|
|
751
|
+
export const IMAGE_RECIPE_VERSION = 5
|
|
715
752
|
|
|
716
753
|
export function buildImageScript(params: {
|
|
717
754
|
/** `script`: the feature's install script itself, embedded as is (an app that serves its own). */
|
|
718
755
|
features: { id: string; ociRef?: string; options?: Record<string, string>; script?: string }[]
|
|
719
756
|
vscodeExtensions?: string[]
|
|
720
757
|
sshGatewayPublicKey?: string
|
|
721
|
-
/** Project-level DinD opt-in (base image bakes Docker itself, no feature). See projects.dind. */
|
|
722
|
-
dind?: boolean
|
|
723
758
|
/**
|
|
724
759
|
* Org setting (organizations.extensionsGallery): raw code-server gallery blob the
|
|
725
760
|
* `--install-extension` calls below resolve ids against. Absent/unusable = Open VSX.
|
|
@@ -732,7 +767,7 @@ export function buildImageScript(params: {
|
|
|
732
767
|
* then installed only if one of the features brought a code-server.
|
|
733
768
|
*/
|
|
734
769
|
codeServerInPack?: boolean
|
|
735
|
-
}): { script: string;
|
|
770
|
+
}): { script: string; resolvedFeatures: ResolvedFeature[]; steps: BuildStep[] } {
|
|
736
771
|
const lines: string[] = ["set -e"]
|
|
737
772
|
|
|
738
773
|
// Every block of the build declares itself, so the UI can show the whole plan upfront and light
|
|
@@ -789,7 +824,6 @@ export function buildImageScript(params: {
|
|
|
789
824
|
'command -v curl >/dev/null 2>&1 || echo "[build] WARNING: curl unavailable — feature installs will fail"',
|
|
790
825
|
])
|
|
791
826
|
|
|
792
|
-
const hasDinD = params.features.some((f) => f.id === "docker-in-docker") || !!params.dind
|
|
793
827
|
// The two features every worker image is made of, ahead of whatever the project picked. The user
|
|
794
828
|
// can select common-utils in the picker too — its options are then merged over ours rather than
|
|
795
829
|
// installed a second time.
|
|
@@ -814,8 +848,8 @@ export function buildImageScript(params: {
|
|
|
814
848
|
}
|
|
815
849
|
|
|
816
850
|
// Save entrypoints to a durable location. Append (not overwrite) + dedup so an entrypoint
|
|
817
|
-
// already baked into the base image
|
|
818
|
-
//
|
|
851
|
+
// already baked into the base image survives alongside any registered by features installed here.
|
|
852
|
+
// The features' lifecycle hooks the same way, in install order (deduplicated, never sorted).
|
|
819
853
|
const finalizeBody = [
|
|
820
854
|
"if [ -f " + FEATURE_ENTRYPOINTS_STAGING_FILE + " ]; then",
|
|
821
855
|
" touch " + FEATURE_ENTRYPOINTS_FILE,
|
|
@@ -824,6 +858,15 @@ export function buildImageScript(params: {
|
|
|
824
858
|
" rm -f " + FEATURE_ENTRYPOINTS_STAGING_FILE,
|
|
825
859
|
' echo "[build] Entrypoints saved to ' + FEATURE_ENTRYPOINTS_FILE + '"',
|
|
826
860
|
"fi",
|
|
861
|
+
"if [ -d " + FEATURE_HOOKS_STAGING_DIR + " ]; then",
|
|
862
|
+
" mkdir -p " + FEATURE_HOOKS_DIR,
|
|
863
|
+
" for _h in " + FEATURE_HOOKS_STAGING_DIR + "/*; do",
|
|
864
|
+
' _t="' + FEATURE_HOOKS_DIR + '/$(basename "$_h")"',
|
|
865
|
+
' cat "$_h" >> "$_t" && awk \'!seen[$0]++\' "$_t" > "$_t.tmp" && mv "$_t.tmp" "$_t"',
|
|
866
|
+
" done",
|
|
867
|
+
" rm -rf " + FEATURE_HOOKS_STAGING_DIR,
|
|
868
|
+
' echo "[build] Feature lifecycle hooks saved to ' + FEATURE_HOOKS_DIR + '"',
|
|
869
|
+
"fi",
|
|
827
870
|
]
|
|
828
871
|
|
|
829
872
|
// Install VS Code extensions to a system path (not in /home, which is per-worker)
|
|
@@ -882,7 +925,7 @@ export function buildImageScript(params: {
|
|
|
882
925
|
'echo "[build] Image build complete"',
|
|
883
926
|
])
|
|
884
927
|
|
|
885
|
-
return { script: lines.join("\n"),
|
|
928
|
+
return { script: lines.join("\n"), resolvedFeatures, steps }
|
|
886
929
|
}
|
|
887
930
|
|
|
888
931
|
// ─── 2. buildSetupScript ──────────────────────────────────────────────────────
|
|
@@ -897,7 +940,6 @@ export type SetupScriptParams = {
|
|
|
897
940
|
repositories: { id: string; provider: string; project: string; workspacePath: string; installationId?: number; cloneUrl?: string; branch?: string }[]
|
|
898
941
|
features: { id: string; ociRef?: string; options?: Record<string, string> }[] | null
|
|
899
942
|
vscodeExtensions?: string[] | null
|
|
900
|
-
dind?: boolean | null
|
|
901
943
|
postCreateCommand: string | null
|
|
902
944
|
postStartCommand?: string | null
|
|
903
945
|
}
|
|
@@ -1169,43 +1211,32 @@ export function buildSetupScript(params: SetupScriptParams): { script: string }
|
|
|
1169
1211
|
push("", `chown -R ${username}:${username} /workspace`)
|
|
1170
1212
|
}
|
|
1171
1213
|
|
|
1172
|
-
// ── 6.
|
|
1173
|
-
//
|
|
1174
|
-
//
|
|
1175
|
-
// `docker run` work during postCreate. Also wait for the Docker socket if
|
|
1176
|
-
// docker-in-docker is present.
|
|
1177
|
-
// `project.dind` makes DinD available without the docker-in-docker feature (baked into the base
|
|
1178
|
-
// image, see images/worker-base) — treat it like the feature for entrypoint start + docker wait.
|
|
1179
|
-
const hasDinDFeature = (project.features?.some((f) => f.id === "docker-in-docker") ?? false) || !!project.dind
|
|
1214
|
+
// ── 6. Entrypoints, then the features' create hooks ──────────────────────
|
|
1215
|
+
// Entrypoints are normally started by buildStartScript, but what runs before it — the features'
|
|
1216
|
+
// hooks, the project's postCreate — may need them (dockerd). Started here when the image has any.
|
|
1180
1217
|
// `_MP_EP_STARTED` tells the every-start block of the same run (buildWorkerScript inlines both in
|
|
1181
1218
|
// one shell) not to start them a second time: the docker-in-docker feature's entrypoint doesn't
|
|
1182
1219
|
// check for a running daemon, and a second dockerd fails on the volume store lock — after having
|
|
1183
1220
|
// replaced the first one's socket, leaving Docker unreachable for postStart and everything after.
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
" sleep 1",
|
|
1204
|
-
"done",
|
|
1205
|
-
'docker info >/dev/null 2>&1 && echo "Docker daemon ready" || echo "Docker daemon not ready after 30s, continuing anyway"',
|
|
1206
|
-
)
|
|
1207
|
-
}
|
|
1208
|
-
}
|
|
1221
|
+
// Nothing here knows Docker: docker-in-docker waits for its own daemon in its postCreateCommand.
|
|
1222
|
+
push(
|
|
1223
|
+
"",
|
|
1224
|
+
"if [ -f " + FEATURE_ENTRYPOINTS_FILE + " ]; then",
|
|
1225
|
+
" _MP_EP_STARTED=1",
|
|
1226
|
+
' echo "--- Starting feature entrypoints ---"',
|
|
1227
|
+
" while IFS= read -r _ep; do",
|
|
1228
|
+
' if [ -f "$_ep" ]; then',
|
|
1229
|
+
' echo "Starting entrypoint: $_ep"',
|
|
1230
|
+
' "$_ep" &',
|
|
1231
|
+
" fi",
|
|
1232
|
+
" done < " + FEATURE_ENTRYPOINTS_FILE,
|
|
1233
|
+
"fi",
|
|
1234
|
+
`if [ ! -f "${homeDir}/.mp-feature-hooks-done" ]; then`,
|
|
1235
|
+
...featureHookLines("onCreateCommand", username).map((l) => (l ? " " + l : l)),
|
|
1236
|
+
...featureHookLines("postCreateCommand", username).map((l) => (l ? " " + l : l)),
|
|
1237
|
+
` touch "${homeDir}/.mp-feature-hooks-done"`,
|
|
1238
|
+
"fi",
|
|
1239
|
+
)
|
|
1209
1240
|
|
|
1210
1241
|
if (project.postCreateCommand) {
|
|
1211
1242
|
const postCreateDir = project.repositories.length === 1
|
|
@@ -1251,7 +1282,6 @@ export type StartScriptParams = {
|
|
|
1251
1282
|
name?: string
|
|
1252
1283
|
features: { id: string; ociRef?: string; options?: Record<string, string> }[] | null
|
|
1253
1284
|
vscodeExtensions?: string[] | null
|
|
1254
|
-
dind?: boolean | null
|
|
1255
1285
|
postCreateCommand: string | null
|
|
1256
1286
|
postStartCommand: string | null
|
|
1257
1287
|
repositories: { project: string; workspacePath: string }[]
|
|
@@ -1289,7 +1319,7 @@ function idePortOf(port: number | undefined): number {
|
|
|
1289
1319
|
return port
|
|
1290
1320
|
}
|
|
1291
1321
|
|
|
1292
|
-
export function buildStartScript(params: StartScriptParams): { script: string
|
|
1322
|
+
export function buildStartScript(params: StartScriptParams): { script: string } {
|
|
1293
1323
|
const { project, sshGatewayPublicKey, colorTabsByProject, extensionsGallery } = params
|
|
1294
1324
|
const idePort = idePortOf(params.idePort)
|
|
1295
1325
|
const ide = params.ide !== false
|
|
@@ -1299,7 +1329,6 @@ export function buildStartScript(params: StartScriptParams): { script: string; h
|
|
|
1299
1329
|
const features = project.features ?? []
|
|
1300
1330
|
const hasPostCreate = !!project.postCreateCommand
|
|
1301
1331
|
const hasPostStart = !!project.postStartCommand
|
|
1302
|
-
const hasDinD = features.some((f) => f.id === "docker-in-docker") || !!project.dind
|
|
1303
1332
|
|
|
1304
1333
|
const allReposDone: RS[] = project.repositories.map((r) => ({ name: r.project, state: "done" }))
|
|
1305
1334
|
|
|
@@ -1497,24 +1526,9 @@ export function buildStartScript(params: StartScriptParams): { script: string; h
|
|
|
1497
1526
|
// reports as `running` only while it lives — waiting at the end. A sleeper does, in its place.
|
|
1498
1527
|
if (!ide) push("", "while true; do sleep 3600; done &")
|
|
1499
1528
|
|
|
1500
|
-
// ── 6. postStartCommand
|
|
1501
|
-
//
|
|
1502
|
-
|
|
1503
|
-
// the base image or via a differently-named feature. Strategy: give the socket
|
|
1504
|
-
// up to 5s to appear; if it shows up, wait up to 30s for the daemon to be ready.
|
|
1505
|
-
if (project.postStartCommand) {
|
|
1506
|
-
push(
|
|
1507
|
-
"",
|
|
1508
|
-
"if [ -f " + FEATURE_ENTRYPOINTS_FILE + " ]; then",
|
|
1509
|
-
" for _i in 1 2 3 4 5; do [ -S /var/run/docker.sock ] && break || sleep 1; done",
|
|
1510
|
-
" if [ -S /var/run/docker.sock ]; then",
|
|
1511
|
-
' echo "Waiting for Docker daemon..."',
|
|
1512
|
-
" for _i in $(seq 1 30); do docker info >/dev/null 2>&1 && break; sleep 1; done",
|
|
1513
|
-
' docker info >/dev/null 2>&1 && echo "Docker daemon ready" || echo "Docker daemon not ready, continuing"',
|
|
1514
|
-
" fi",
|
|
1515
|
-
"fi",
|
|
1516
|
-
)
|
|
1517
|
-
}
|
|
1529
|
+
// ── 6. The features' postStart hooks, then the project's postStartCommand ─
|
|
1530
|
+
// At every start, before the project's: docker-in-docker waits there for its daemon.
|
|
1531
|
+
push(...featureHookLines("postStartCommand", username))
|
|
1518
1532
|
|
|
1519
1533
|
if (project.postStartCommand) {
|
|
1520
1534
|
const postStartDir = project.repositories.length === 1
|
|
@@ -1542,7 +1556,7 @@ export function buildStartScript(params: StartScriptParams): { script: string; h
|
|
|
1542
1556
|
push("_MP_DONE=1")
|
|
1543
1557
|
push("", "wait")
|
|
1544
1558
|
|
|
1545
|
-
return { script: lines.join("\n")
|
|
1559
|
+
return { script: lines.join("\n") }
|
|
1546
1560
|
}
|
|
1547
1561
|
|
|
1548
1562
|
// ─── buildWorkerScript ────────────────────────────────────────────────────────
|
|
@@ -1580,14 +1594,13 @@ export type SetupPhase = {
|
|
|
1580
1594
|
// now). Ends by signalling readiness (`.mp-container-up`) then `wait`. Blocks are duplicated from
|
|
1581
1595
|
// buildStartScript on purpose: the legacy path stays byte-identical (prod default) until it's
|
|
1582
1596
|
// deleted once WORKER_SETUP_ORCHESTRATOR=agent becomes the default. See RFC 0017 §2.1.
|
|
1583
|
-
export function buildContainerScript(params: StartScriptParams): { script: string
|
|
1597
|
+
export function buildContainerScript(params: StartScriptParams): { script: string } {
|
|
1584
1598
|
const { project, sshGatewayPublicKey, colorTabsByProject, extensionsGallery } = params
|
|
1585
1599
|
const idePort = idePortOf(params.idePort)
|
|
1586
1600
|
const homeDir = "/home/vscode"
|
|
1587
1601
|
const username = "vscode"
|
|
1588
1602
|
|
|
1589
1603
|
const features = project.features ?? []
|
|
1590
|
-
const hasDinD = features.some((f) => f.id === "docker-in-docker") || !!project.dind
|
|
1591
1604
|
|
|
1592
1605
|
const lines: string[] = ["set -e", "export HOME=/home/vscode"]
|
|
1593
1606
|
const push = (...l: string[]) => lines.push(...l)
|
|
@@ -1745,7 +1758,7 @@ export function buildContainerScript(params: StartScriptParams): { script: strin
|
|
|
1745
1758
|
"wait",
|
|
1746
1759
|
)
|
|
1747
1760
|
|
|
1748
|
-
return { script: lines.join("\n")
|
|
1761
|
+
return { script: lines.join("\n") }
|
|
1749
1762
|
}
|
|
1750
1763
|
|
|
1751
1764
|
export function buildWorkerScript(params: {
|
|
@@ -2085,22 +2098,12 @@ export function buildSetupPlan(params: SetupScriptParams): {
|
|
|
2085
2098
|
|
|
2086
2099
|
// ── postCreate ──────────────────────────────────────────────────────────────
|
|
2087
2100
|
if (project.postCreateCommand) {
|
|
2088
|
-
const hasDinDFeature = (project.features?.some((f) => f.id === "docker-in-docker") ?? false) || !!project.dind
|
|
2089
2101
|
const postCreateDir = project.repositories.length === 1
|
|
2090
2102
|
? `/workspace/${project.repositories[0].workspacePath}`
|
|
2091
2103
|
: "/workspace"
|
|
2092
|
-
|
|
2093
|
-
//
|
|
2094
|
-
|
|
2095
|
-
l.push(
|
|
2096
|
-
'echo "Waiting for Docker daemon..."',
|
|
2097
|
-
"for _i in $(seq 1 30); do",
|
|
2098
|
-
" docker info >/dev/null 2>&1 && break",
|
|
2099
|
-
" sleep 1",
|
|
2100
|
-
"done",
|
|
2101
|
-
'docker info >/dev/null 2>&1 && echo "Docker daemon ready" || echo "Docker daemon not ready after 30s, continuing anyway"',
|
|
2102
|
-
)
|
|
2103
|
-
}
|
|
2104
|
+
// Feature entrypoints are started by the passive CMD; the features' own create hooks come first
|
|
2105
|
+
// (docker-in-docker waits there for its daemon).
|
|
2106
|
+
const l: string[] = ["set -e", ...featureHookLines("onCreateCommand", username), ...featureHookLines("postCreateCommand", username)]
|
|
2104
2107
|
l.push(...banner("SETUP: POST CREATE"))
|
|
2105
2108
|
const cmdEncoded = b64(project.postCreateCommand)
|
|
2106
2109
|
l.push(
|
|
@@ -2129,18 +2132,7 @@ export function buildSetupPlan(params: SetupScriptParams): {
|
|
|
2129
2132
|
const postStartDir = project.repositories.length === 1
|
|
2130
2133
|
? `/workspace/${project.repositories[0].workspacePath}`
|
|
2131
2134
|
: "/workspace"
|
|
2132
|
-
const l: string[] = ["set -e",
|
|
2133
|
-
// Same defensive Docker wait as legacy: some images ship Docker under a different name.
|
|
2134
|
-
"if [ -f " + FEATURE_ENTRYPOINTS_FILE + " ]; then",
|
|
2135
|
-
" for _i in 1 2 3 4 5; do [ -S /var/run/docker.sock ] && break || sleep 1; done",
|
|
2136
|
-
" if [ -S /var/run/docker.sock ]; then",
|
|
2137
|
-
' echo "Waiting for Docker daemon..."',
|
|
2138
|
-
" for _i in $(seq 1 30); do docker info >/dev/null 2>&1 && break; sleep 1; done",
|
|
2139
|
-
' docker info >/dev/null 2>&1 && echo "Docker daemon ready" || echo "Docker daemon not ready, continuing"',
|
|
2140
|
-
" fi",
|
|
2141
|
-
"fi",
|
|
2142
|
-
...banner("START: POST START"),
|
|
2143
|
-
]
|
|
2135
|
+
const l: string[] = ["set -e", ...featureHookLines("postStartCommand", username), ...banner("START: POST START")]
|
|
2144
2136
|
const cmdEncoded = b64(project.postStartCommand)
|
|
2145
2137
|
l.push(
|
|
2146
2138
|
`echo "--- Running postStartCommand ---"`,
|
package/src/spec/index.ts
CHANGED
|
@@ -89,7 +89,6 @@ export const SpecProjectSchema = z.object({
|
|
|
89
89
|
features: z.array(SpecFeatureSchema).default([]),
|
|
90
90
|
vscodeExtensions: z.array(z.string()).default([]),
|
|
91
91
|
prewarmImages: z.array(z.string()).default([]),
|
|
92
|
-
dind: z.boolean().default(false),
|
|
93
92
|
postCreateCommand: z.string().nullable().optional(),
|
|
94
93
|
postStartCommand: z.string().nullable().optional(),
|
|
95
94
|
repositories: z.array(SpecRepositorySchema).default([]),
|