@outerlayer/cli 0.38.0-next.20261110212358 → 0.38.0-next.20261111024231
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/README.md +8 -0
- package/dist/agent-setup-T2VITZUY.js +40 -0
- package/dist/{agent-subcommand-5PNHUNZZ.js → agent-subcommand-KV3JO5YD.js} +4 -4
- package/dist/{artifact-link-cmd-XOFZP7U5.js → artifact-link-cmd-L4BXSQQP.js} +2 -2
- package/dist/{bridge-RNM7OWRW.js → bridge-7MCKZXCR.js} +7 -7
- package/dist/{build-VKO7IVOQ.js → build-N2MRLYFW.js} +13 -13
- package/dist/{build-disk-M2JYJF6R.js → build-disk-IJZYZ2K5.js} +11 -11
- package/dist/build-info.json +1 -1
- package/dist/{builder-HMHJ6U7C.js → builder-ATKIRCDJ.js} +10 -10
- package/dist/caller-OWXJDYPI.js +23 -0
- package/dist/{check-3XHEVEXS.js → check-F7RN65GG.js} +55 -55
- package/dist/{chunk-2TXYQANG.js → chunk-2FUJ5PSV.js} +1 -1
- package/dist/{chunk-SBPMDO47.js → chunk-2HLMGVK6.js} +1 -1
- package/dist/{chunk-TW2V2IQ4.js → chunk-2KUFDLLY.js} +1 -1
- package/dist/{chunk-L32O52SH.js → chunk-2PRDLE4L.js} +1 -1
- package/dist/{chunk-DKDBMMX7.js → chunk-3VEPVZV4.js} +6 -6
- package/dist/{chunk-5QFFQCSY.js → chunk-4HUYH65P.js} +1 -1
- package/dist/{chunk-NE7EG3SN.js → chunk-4YAFIOIV.js} +19 -4
- package/dist/{chunk-3HJK7WTM.js → chunk-5NJ367OD.js} +137 -14
- package/dist/{chunk-2WNJ2MHD.js → chunk-64ROJ5LD.js} +1 -1
- package/dist/{chunk-C574RHGN.js → chunk-6T2X2JI6.js} +3 -3
- package/dist/{chunk-OI4ZV7MJ.js → chunk-6U3UTAWQ.js} +1 -1
- package/dist/{chunk-67BVM7JK.js → chunk-7G2HRTSG.js} +3 -3
- package/dist/{chunk-IGO766M6.js → chunk-7GYY7RHR.js} +4 -4
- package/dist/{chunk-XCTE5S2C.js → chunk-7HYXJVU6.js} +1 -1
- package/dist/{chunk-UUSSRXUJ.js → chunk-7LWASV77.js} +3 -3
- package/dist/{chunk-WH2QUYXH.js → chunk-7U43B2UB.js} +2 -2
- package/dist/{chunk-QFQ2UNZU.js → chunk-AB4GMYIH.js} +6 -6
- package/dist/{chunk-S56J4BMQ.js → chunk-ASCXEXYJ.js} +10 -10
- package/dist/{chunk-6XROZIV6.js → chunk-BY2YRJSC.js} +6 -6
- package/dist/{chunk-ITOIM3WV.js → chunk-CSFMIUYS.js} +1 -1
- package/dist/{chunk-MBPBYMHU.js → chunk-E5G6K7C4.js} +1 -1
- package/dist/{chunk-XFU37HIM.js → chunk-ECMQNH2H.js} +3 -3
- package/dist/{chunk-3GTAPQBG.js → chunk-EWGHEMEO.js} +2 -2
- package/dist/{chunk-VNHDMOZW.js → chunk-FB2UT5XA.js} +57 -32
- package/dist/{chunk-KGHYNTF6.js → chunk-FT5NDSSG.js} +7 -7
- package/dist/{chunk-MT4XF5OL.js → chunk-G2CRPYFO.js} +2 -2
- package/dist/{chunk-RBLXGO5K.js → chunk-GGKXYHT5.js} +2 -2
- package/dist/{chunk-YOAJLD2D.js → chunk-GPP5EZV7.js} +7 -7
- package/dist/{chunk-TUSIYONR.js → chunk-HWXBOHEA.js} +1 -1
- package/dist/{chunk-HMDEF3UT.js → chunk-I5C667TJ.js} +16 -16
- package/dist/{chunk-OEWSICWM.js → chunk-IB2UHXZ7.js} +8 -8
- package/dist/{chunk-F2ADK2KB.js → chunk-ICW75TS5.js} +5 -5
- package/dist/{chunk-UCUBQWJC.js → chunk-IEX5FXEU.js} +3 -3
- package/dist/{chunk-47JRSV6Y.js → chunk-J4DTF5MN.js} +1 -1
- package/dist/{chunk-MSARYPFD.js → chunk-JPAO6HRN.js} +2 -2
- package/dist/{chunk-PA6FKP5B.js → chunk-K6KUWUUT.js} +6 -6
- package/dist/{chunk-I64CTY4U.js → chunk-KGJAYD7F.js} +829 -640
- package/dist/{chunk-ENHD5PNW.js → chunk-KM2IMFAG.js} +1 -1
- package/dist/{chunk-ALCZ2SEW.js → chunk-LXREVZX7.js} +5 -5
- package/dist/{chunk-VU5PPWIQ.js → chunk-M5DYOU5G.js} +7 -7
- package/dist/{chunk-HDEYRLWK.js → chunk-MPF7CVQM.js} +1 -1
- package/dist/{chunk-L6CZTRNW.js → chunk-MRSN67FY.js} +1 -1
- package/dist/{chunk-OK4RSIB2.js → chunk-N3KGXHV4.js} +1 -1
- package/dist/{chunk-7E55P2NR.js → chunk-NAKFPE2V.js} +1 -1
- package/dist/{chunk-VQQF6MDT.js → chunk-NC6HUEMI.js} +10 -10
- package/dist/{chunk-FXVHF6RX.js → chunk-NEXKR5RR.js} +64 -13
- package/dist/{chunk-FGBBGUM4.js → chunk-NWSKP5VI.js} +4 -4
- package/dist/{chunk-5QDHJT73.js → chunk-O53PVAUY.js} +6 -5
- package/dist/{chunk-QGUCHNSQ.js → chunk-OBSWWJJ3.js} +3 -3
- package/dist/{chunk-3DY4DQOC.js → chunk-OBXRHBOM.js} +4 -4
- package/dist/{chunk-BTH6HTE5.js → chunk-OUKSF3LK.js} +5 -5
- package/dist/{chunk-6RQP5GP5.js → chunk-OVJSVC5U.js} +2 -2
- package/dist/{chunk-YO2NPS66.js → chunk-PG33WPRF.js} +1 -1
- package/dist/{chunk-E27XMQKR.js → chunk-PP7MPUX7.js} +3 -3
- package/dist/{chunk-B5Z4VA4Q.js → chunk-QHYCF36K.js} +1 -1
- package/dist/{chunk-EHPKACA7.js → chunk-QM3M7QN3.js} +1 -1
- package/dist/{chunk-IVB6A3I7.js → chunk-R35KRBTS.js} +7 -7
- package/dist/{chunk-VRWZNI6U.js → chunk-R7BS36HP.js} +1 -1
- package/dist/{chunk-I2N427GS.js → chunk-REZNW2YV.js} +8 -8
- package/dist/{chunk-735C5J6Q.js → chunk-RPIYENP2.js} +5 -5
- package/dist/{chunk-GJMLLXZJ.js → chunk-RWXLTF3K.js} +1 -1
- package/dist/{chunk-AC6DM3S3.js → chunk-T5CN56UE.js} +1 -1
- package/dist/{chunk-CXXQQST7.js → chunk-U5YHNSSI.js} +9 -9
- package/dist/{chunk-72LXVD4O.js → chunk-W2H6JURI.js} +4 -4
- package/dist/{chunk-BCQFMAGM.js → chunk-WPGGRTF4.js} +3 -3
- package/dist/{chunk-YZQYTOCR.js → chunk-XMIL73Y2.js} +1 -1
- package/dist/{chunk-25G5KXBE.js → chunk-XSVZFWZ4.js} +7 -7
- package/dist/{chunk-OWEJP5HJ.js → chunk-YB3M2TM3.js} +1 -1
- package/dist/{chunk-B4U5XI4F.js → chunk-YFMVZBLO.js} +8 -8
- package/dist/{chunk-XAR2CJFV.js → chunk-YFQIK6LZ.js} +7 -7
- package/dist/{chunk-ATQHPT3B.js → chunk-YI2XPK7A.js} +1 -1
- package/dist/{chunk-TD6DN5LU.js → chunk-ZGCIFD5Y.js} +3 -3
- package/dist/{claude-launcher-WMIUTAXY.js → claude-launcher-ZC664P33.js} +7 -7
- package/dist/{cli-PS6GSOAE.js → cli-XWXX6PJD.js} +157 -157
- package/dist/{command-XQPL75PX.js → command-D656K4AE.js} +50 -50
- package/dist/{config-ZRGYLVDX.js → config-U2OR7MQW.js} +12 -12
- package/dist/{connect-cmd-MZXTWM4R.js → connect-cmd-73BBTTU5.js} +13 -13
- package/dist/{container-start-M7SFF62T.js → container-start-JFJYC4GQ.js} +48 -48
- package/dist/{context-cleanup-Z3HZZZXW.js → context-cleanup-JPPSK7DE.js} +4 -4
- package/dist/{context-show-cmd-SCOVPVDM.js → context-show-cmd-ETWKBHXZ.js} +14 -14
- package/dist/{control-plane-launch-MWZHJ4G5.js → control-plane-launch-JOH7FS5U.js} +14 -14
- package/dist/{demo-record-cmd-4RVSWVMK.js → demo-record-cmd-GBHPIYJA.js} +8 -8
- package/dist/{demo-voice-cmd-TQP3PZE2.js → demo-voice-cmd-GUYFA2NG.js} +20 -20
- package/dist/{dist-XEPPXF4M.js → dist-5VKIP767.js} +2 -2
- package/dist/{docker-25F2KOBJ.js → docker-RC4CFNKI.js} +10 -10
- package/dist/{doctor-Z3U3ICVR.js → doctor-TW6VREAT.js} +50 -50
- package/dist/{emit-artifact-cmd-Z4SHPKFT.js → emit-artifact-cmd-CQLCPM4R.js} +19 -19
- package/dist/{emit-cmd-NHMZ4M5S.js → emit-cmd-AIAY4WTW.js} +7 -7
- package/dist/{emit-criteria-cmd-HCN3DOJM.js → emit-criteria-cmd-VM7AO3E3.js} +16 -16
- package/dist/{emit-demo-cmd-R3TIGMFX.js → emit-demo-cmd-3NSODQTO.js} +20 -20
- package/dist/{emit-finding-cmd-YXR3ZVCJ.js → emit-finding-cmd-4CRLSMOK.js} +16 -16
- package/dist/{emit-result-cmd-Z7MBE37R.js → emit-result-cmd-GM43QMCM.js} +18 -18
- package/dist/{emit-step-cmd-JOSYDSEO.js → emit-step-cmd-J7KS2QXL.js} +16 -16
- package/dist/{exec-client-SZRXXKJ5.js → exec-client-DY7673SD.js} +8 -8
- package/dist/find-unit-ZVHHFTL2.js +24 -0
- package/dist/{findings-cmd-NGFY25WZ.js → findings-cmd-25F44AB4.js} +16 -16
- package/dist/{fleet-readiness-NWIVQQ4P.js → fleet-readiness-Z4C6W7XN.js} +14 -14
- package/dist/governing-source-IURJZXUR.js +41 -0
- package/dist/{guest-init-T7QJW2AJ.js → guest-init-4B5MMXIQ.js} +9 -9
- package/dist/{hook-fast-ECQBMESE.js → hook-fast-LB3VTEIW.js} +1 -1
- package/dist/{hook-install-MBMG3G6B.js → hook-install-QQXREIMI.js} +4 -4
- package/dist/host-checks-AQTZ7IKK.js +80 -0
- package/dist/host-key-ZWMN7VIH.js +18 -0
- package/dist/{image-tag-OCVY4W5D.js → image-tag-4DKLSTO6.js} +8 -8
- package/dist/index.js +4 -4
- package/dist/init-P2PDGLTU.js +80 -0
- package/dist/{init-NRN2DQC3.js → init-XYFDIEOA.js} +46 -46
- package/dist/{init-agent-GDOZHPQH.js → init-agent-EGNFBPM5.js} +46 -46
- package/dist/{init-cmd-QJYX47LS.js → init-cmd-C2I22ZJA.js} +27 -27
- package/dist/{init-update-EUJ4264S.js → init-update-H4LSR7H4.js} +24 -24
- package/dist/{install-cmd-HWG6LJX5.js → install-cmd-BI4C3MGF.js} +10 -10
- package/dist/{layout-CGE4KWGO.js → layout-CE6QLPNH.js} +4 -4
- package/dist/{login-browser-G7WNR74C.js → login-browser-COSWHZEC.js} +2 -2
- package/dist/{logs-TKWJ4S4W.js → logs-7DD6J3M6.js} +7 -7
- package/dist/loop-KEGBBAV4.js +90 -0
- package/dist/machine-JK27TGT6.js +80 -0
- package/dist/{machine-skills-CXA57QHE.js → machine-skills-YJLPUAYZ.js} +4 -4
- package/dist/{mcp-install-cmd-6IGK65DV.js → mcp-install-cmd-VSWX5BSZ.js} +4 -4
- package/dist/{mcp-serve-cmd-DVE5XP2U.js → mcp-serve-cmd-HK2ODMHU.js} +9 -9
- package/dist/{paths-VOWYUJLZ.js → paths-EHWU5QWB.js} +7 -7
- package/dist/pending-K4A23JIC.js +18 -0
- package/dist/{pidfile-MFP6B2KV.js → pidfile-PG3L2CVV.js} +8 -8
- package/dist/{record-AWCJ3LTG.js → record-PXCRTDQU.js} +8 -8
- package/dist/{relay-YVZM5M6B.js → relay-2MJY25BV.js} +5 -5
- package/dist/{relay-protocol-MNWITORT.js → relay-protocol-VBCRA347.js} +5 -5
- package/dist/{run-cmd-MBH5Z2UL.js → run-cmd-F7ANZPSX.js} +16 -16
- package/dist/{runner-agents-L3PLYFWJ.js → runner-agents-HZ5FIFPU.js} +4 -4
- package/dist/runner-env-5AM2XYEN.js +24 -0
- package/dist/{runner-identity-E2XKIJNB.js → runner-identity-CL2KMFGC.js} +10 -10
- package/dist/{runner-key-W5M6AYY5.js → runner-key-CJ66VZE3.js} +46 -46
- package/dist/{session-sender-IS6S7PBC.js → session-sender-RSAHCLL6.js} +19 -19
- package/dist/{spec-cmd-ZLDYL4N5.js → spec-cmd-ED6DKB54.js} +17 -17
- package/dist/{starter-pack-XINCCMDN.js → starter-pack-IT2KYFWU.js} +5 -5
- package/dist/state-MV53BATE.js +18 -0
- package/dist/{status-L7R6FKWD.js → status-CZTCYZLU.js} +46 -46
- package/dist/{sync-cmd-3YZ4IB3T.js → sync-cmd-PQZD77PE.js} +18 -18
- package/dist/update-steps-DCFEKNW2.js +81 -0
- package/dist/{watch-LIIODJ5U.js → watch-FAQXAAUA.js} +18 -18
- package/dist/{work-claim-cmd-GWBWIZ43.js → work-claim-cmd-XPXHRV74.js} +22 -22
- package/dist/{work-cmd-CJWTGOU5.js → work-cmd-ME7DWBI6.js} +16 -16
- package/dist/{work-comment-cmd-RFVCNEET.js → work-comment-cmd-ZT4O56QR.js} +18 -18
- package/dist/{work-demo-cmd-Q2GKJCVL.js → work-demo-cmd-YV22MZXG.js} +16 -16
- package/dist/{work-logs-cmd-KZQBPU2J.js → work-logs-cmd-LUK7THB2.js} +16 -16
- package/dist/{work-needs-attention-cmd-L3DOYAMK.js → work-needs-attention-cmd-KTLWMBJV.js} +16 -16
- package/dist/{work-no-change-cmd-SHP25CJB.js → work-no-change-cmd-TWGW5ZOO.js} +16 -16
- package/dist/{work-open-pr-cmd-VATPLVSL.js → work-open-pr-cmd-VEM5MEUS.js} +17 -17
- package/dist/{work-pr-cmd-XBLNONT3.js → work-pr-cmd-M4G35ZIV.js} +16 -16
- package/dist/{work-proofs-cmd-7HSLB52S.js → work-proofs-cmd-7EZ4QZUR.js} +18 -18
- package/dist/{work-proofs-record-BE6UMZPH.js → work-proofs-record-AY72YKNC.js} +24 -24
- package/dist/{work-stop-cmd-BLOSL24H.js → work-stop-cmd-FX5QTUYJ.js} +16 -16
- package/package.json +1 -1
- package/skill-pack/maintained/outerlayer-findings/SKILL.md +46 -41
- package/skill-pack/maintained/outerlayer-findings/references/examples.md +23 -0
- package/dist/agent-setup-GZBGCV3K.js +0 -40
- package/dist/caller-U26SATTV.js +0 -23
- package/dist/find-unit-3RHC4375.js +0 -24
- package/dist/governing-source-DNWVPRXP.js +0 -41
- package/dist/host-checks-QLGWXKOC.js +0 -80
- package/dist/host-key-6SMJUTJ2.js +0 -18
- package/dist/init-JY3XYZI6.js +0 -80
- package/dist/loop-HWYHQ374.js +0 -90
- package/dist/machine-NVXRV4BO.js +0 -80
- package/dist/pending-35ML3JE5.js +0 -18
- package/dist/runner-env-IHWYZ3B6.js +0 -24
- package/dist/state-NIA6XT7D.js +0 -18
- package/dist/update-steps-6SPAPBAB.js +0 -81
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import { itemsSentence, criteriaOf, hostItemsOf, loadCitationFinder, testFileMatcher, planCriteria, wholeItems, judgeGroups, failedItems, inCriteriaOrder, testsByCriterion, oneLineReason, criterionInputs, parseJudgeAnswer, judgedItems, openPullRequests, MAX_TEST_FILE_BYTES } from './chunk-
|
|
3
|
+
import { itemsSentence, criteriaOf, hostItemsOf, loadCitationFinder, testFileMatcher, planCriteria, wholeItems, judgeGroups, failedItems, inCriteriaOrder, testsByCriterion, oneLineReason, criterionInputs, parseJudgeAnswer, judgedItems, openPullRequests, MAX_TEST_FILE_BYTES } from './chunk-WPGGRTF4.js';
|
|
4
4
|
import { RUNNER_PROTOCOL } from './chunk-6XMC6R4W.js';
|
|
5
5
|
import { sha256OfFile, downloadPinned, VoiceDownloadError } from './chunk-2PGI6RDE.js';
|
|
6
6
|
import { zodProblem } from './chunk-I3LTIAOR.js';
|
|
7
|
-
import { hasStoredCredential, storedCredentialVariables, storeAgentCredential, isAgentName, credentialFromStdin } from './chunk-
|
|
8
|
-
import { upgradedStarterText } from './chunk-
|
|
9
|
-
import { HELPER_PATH, HELPER_RECORD, DOCKERD_LOG } from './chunk-
|
|
10
|
-
import { writeDockerClientConfig } from './chunk-
|
|
11
|
-
import { senderPidfile } from './chunk-
|
|
12
|
-
import { installScrubContext } from './chunk-
|
|
7
|
+
import { hasStoredCredential, storedCredentialVariables, storeAgentCredential, isAgentName, credentialFromStdin } from './chunk-ICW75TS5.js';
|
|
8
|
+
import { upgradedStarterText } from './chunk-OUKSF3LK.js';
|
|
9
|
+
import { HELPER_PATH, HELPER_RECORD, DOCKERD_LOG } from './chunk-7LWASV77.js';
|
|
10
|
+
import { writeDockerClientConfig } from './chunk-2PRDLE4L.js';
|
|
11
|
+
import { senderPidfile } from './chunk-NWSKP5VI.js';
|
|
12
|
+
import { installScrubContext } from './chunk-U5YHNSSI.js';
|
|
13
13
|
import { readsJobState, READ_JOB_STATE_FORMATS, jobStateFormatOf } from './chunk-ZVB57WI6.js';
|
|
14
|
-
import { runnerImageVersion } from './chunk-
|
|
15
|
-
import { claimCalls, spoolHomeFor, itemCalls, claimItem, leftByRunnerKey, configForJob } from './chunk-
|
|
14
|
+
import { runnerImageVersion } from './chunk-64ROJ5LD.js';
|
|
15
|
+
import { claimCalls, spoolHomeFor, itemCalls, claimItem, leftByRunnerKey, configForJob } from './chunk-JPAO6HRN.js';
|
|
16
16
|
import { receiveFiles } from './chunk-NN33FYXG.js';
|
|
17
|
-
import { readDefaultBranchFiles, readDefaultBranchHead, buildRepositoryImage, fetchCommit, readBranchHead, diffBetween, prepareImageBuild, KEY_PREFIX, TAG_HOST, SHARED_OWNER, SHARED_NAME, universalBase, metadataFromLabels, writeRecord } from './chunk-
|
|
18
|
-
import { FETCHED_DIR, toolsDockerfile, FETCHED_FFMPEG, FETCHED_GH, FETCHED_TINI, FETCHED_HEADLESS_SHELL, FETCHED_PLAYWRIGHT_FFMPEG, FETCHED_VOICE_DIR } from './chunk-
|
|
17
|
+
import { readDefaultBranchFiles, readDefaultBranchHead, buildRepositoryImage, fetchCommit, readBranchHead, diffBetween, prepareImageBuild, KEY_PREFIX, TAG_HOST, SHARED_OWNER, SHARED_NAME, universalBase, metadataFromLabels, writeRecord } from './chunk-YFQIK6LZ.js';
|
|
18
|
+
import { FETCHED_DIR, toolsDockerfile, FETCHED_FFMPEG, FETCHED_GH, FETCHED_TINI, FETCHED_HEADLESS_SHELL, FETCHED_PLAYWRIGHT_FFMPEG, FETCHED_VOICE_DIR } from './chunk-W2H6JURI.js';
|
|
19
19
|
import { isSameProcess, startTimeOf } from './chunk-JBJTC3UU.js';
|
|
20
20
|
import { currentCliBuild } from './chunk-OGFGZQA3.js';
|
|
21
|
-
import { vmExecArgs, runExec, execCapture, waitForAgent } from './chunk-
|
|
22
|
-
import { socketPathProblem, vsockLinks, linkVsockSockets, GUEST_CID, LEASE_LINK } from './chunk-
|
|
23
|
-
import { describeCallFailure, shortClaim, retrySend,
|
|
24
|
-
import { postJson, WorkCommandError, isSignatureRefusal, getJson } from './chunk-
|
|
25
|
-
import { isBuiltinContainer, isBuiltinVm, isBuiltinSandbox, keyRunnerFactory, runnerCredentialProblem, builtinKind,
|
|
26
|
-
import { formatBytes, volumeBytes, allocatedBytes, DEFAULT_BUILD_DISK, DEFAULT_CACHE_DISK, freeBytes } from './chunk-
|
|
27
|
-
import {
|
|
28
|
-
import { universalImagePending, RecipeError, writeSanitizedRecipe, classifyProperties, DOCKER_FEATURE } from './chunk-
|
|
29
|
-
import { sanitizeTerminal, planArtifactUpload } from './chunk-
|
|
30
|
-
import { sharedSkillNames, skillConflictMessage } from './chunk-
|
|
21
|
+
import { vmExecArgs, runExec, execCapture, waitForAgent } from './chunk-7HYXJVU6.js';
|
|
22
|
+
import { socketPathProblem, vsockLinks, linkVsockSockets, GUEST_CID, LEASE_LINK } from './chunk-ZGCIFD5Y.js';
|
|
23
|
+
import { describeCallFailure, shortClaim, retrySend, commandWithShim, logStamp, createRunnerLog, formatDuration, removeKeptContext, formatClock, stageGovernedContext, keptContextTree, removeStagedContext, WORKFLOW_PERMISSION_REASON, refusalCode, SELF_GOVERNED, resolveGoverningSource, prefetchGovernedContext, controlPlaneTokenFailure, keepStagedContext, pinnedSourceOf, shimScript } from './chunk-R35KRBTS.js';
|
|
24
|
+
import { postJson, WorkCommandError, isSignatureRefusal, getJson } from './chunk-YFMVZBLO.js';
|
|
25
|
+
import { isBuiltinContainer, isBuiltinVm, isBuiltinSandbox, keyRunnerFactory, runnerCredentialProblem, builtinKind, optionalEgress, egressSummary, DEFAULT_WORKSPACE_KEEP_DAYS, DEFAULT_CHECK_TIME_LIMIT_MINUTES, DEFAULT_SETUP_MINUTES, allowHostProblem, systemClock, emptyEgressCounts, hostAllowed, sandboxSizeOf, networkOf, sandboxTimeLimitMinutes, imageBuildOf, DEFAULT_SAVED_STATE_MAX_BYTES } from './chunk-O53PVAUY.js';
|
|
26
|
+
import { formatBytes, volumeBytes, allocatedBytes, DEFAULT_BUILD_DISK, DEFAULT_CACHE_DISK, freeBytes } from './chunk-GGKXYHT5.js';
|
|
27
|
+
import { firstLine, writeJobFile, runnerLabelValue, readJobFile, spawnRun, RUNNER_LABEL, BUILD_LABEL, said, NETWORK_HELPER_MEMORY, createDockerHost, builderSpec, containerExecArgs, childEnvironment, readDu, withAnswerProtocol, JUDGE_TREE, MAX_REPORT_BYTES, parseSize, readJobFileChecked, NETWORK_READY_FILE, networkHelperName, prepareRunArgs, containerRunArgs, judgeCommand, JUDGE_DIR, WORKSPACE_LABEL, homeCopyRunArgs, networkHelperRunArgs, JUDGE_MAX_TURNS, JUDGE_ITEMS, answerFileName, hashJudgeProgram, identityScript, identityArgs, parseIdentity, mountableHome, homeCopyScript, homeCopyArgs, COMMAND_DIR, judgeProgramRecord, MAX_ITEMS_BYTES, JUDGE_REPORT, identityRunArgs, SAVED_STATE_LABEL } from './chunk-REZNW2YV.js';
|
|
28
|
+
import { universalImagePending, RecipeError, writeSanitizedRecipe, classifyProperties, DOCKER_FEATURE } from './chunk-2FUJ5PSV.js';
|
|
29
|
+
import { sanitizeTerminal, planArtifactUpload } from './chunk-QHYCF36K.js';
|
|
30
|
+
import { sharedSkillNames, skillConflictMessage } from './chunk-MRSN67FY.js';
|
|
31
31
|
import { readCloudConfig } from './chunk-HWVMRETT.js';
|
|
32
|
-
import { signerFor } from './chunk-
|
|
33
|
-
import { vmAssetsDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE, runnerDir,
|
|
34
|
-
import { BUILD_HOME,
|
|
35
|
-
import { agentCredential,
|
|
32
|
+
import { signerFor } from './chunk-KM2IMFAG.js';
|
|
33
|
+
import { vmAssetsDir, RUNNER_DIR_MODE, RUNNER_FILE_MODE, runnerDir, workspacesDir, jobsDir, storeScopes, spoolDir, orgStoreIn, rootfsDir, imagesDir, sessionsDir, builderCacheDiskPath, buildsDir, buildDir, ghConfigDir, runnerDirOfBuild, mirrorDir, orgHomeDir, jobConsolePath, vsockPath, builderConsolePath, rootfsPathFor, diskTemplatesDir, deliveryDir, SHIM_DIR } from './chunk-T5CN56UE.js';
|
|
34
|
+
import { BUILD_HOME, SandboxError, JOB_MOUNT, heldBuildAuthority, IMAGE_BUNDLES, writeTrustFiles, buildEnvironment, trustEnvironment, CHECKOUT_DIR, parseIsolation, containerLocalAddress, destinationEnvironment, withHooksPath, startBuildServices, headerVariables, authorEnvironment, sharedUserEnvironment, withTunnelRecord, commitIdentityRecord, repositoriesOf, RELAY_PORT, repositoryPath, lifecycleWorkdir, CHECK_ITEMS_FILE, parseProxied, readBundleScript, applyTrust, STAND_IN, proxyEnvironment, describeSandboxError, dropBuildAuthority, sandboxSettingsFrom, createSandboxClient, hostKeyOf, buildAuthorityFor, checkEnvironment, withMiseVariables, checkoutPath, primaryOf, variablesFor, carried6to4, classifyAddress, EVAL_INPUT_DIR, isMiseVariableAllowed, variableForPath, droppedRequestHeaders, hasDotDotSegment, routeNameOf, toolProxyEnvironment } from './chunk-4YAFIOIV.js';
|
|
35
|
+
import { agentCredential, RUNNER_WORDED_REASONS, UNKNOWN_TRACKING_REASON, UNKNOWN_TRANSPORT_REASON, RELAY_USER, currentAgentCredential, removedAgentCredentialValues, managedAgentCredential, realFdStorePort, builtInNames, MAX_MALFORMED_SESSIONS, MALFORMED_REASON, JOIN_WAIT_MS, MAX_OPEN_STREAMS, STREAM_RESET_RATE, STREAM_RESET_BURST, STREAM_WINDOW, SESSION_WINDOW, targetOfPath, AGENT_CREDENTIAL_MISSING, fdName, RELAY_ID, DOCKER_DESKTOP_REASON } from './chunk-7U43B2UB.js';
|
|
36
36
|
import { versionAtLeast } from './chunk-SF2TBJBP.js';
|
|
37
|
-
import { jobAgent, firecrackerArch, MICROVM_ARCHES, FIRECRACKER_VERSION, hostHelperPinned, builderDiskPinned, guestAssetsPinned, runnerAgentNamed, credentialForms, orList, credentialShapes, agentCommands, defaultCommandLine, credentialAgent,
|
|
38
|
-
import { sessionFolderIn, legacyAgent, defaultAgents, parsePolicy, AGENTS_SKILLS_BASE, OUTERLAYER_SKILLS_BASE, orderSessions, extractFacts, sessionsToTimeline, resolvePackRoot } from './chunk-
|
|
37
|
+
import { jobAgent, firecrackerArch, MICROVM_ARCHES, FIRECRACKER_VERSION, hostHelperPinned, builderDiskPinned, guestAssetsPinned, runnerAgentNamed, credentialForms, orList, credentialShapes, agentCommands, defaultCommandLine, credentialAgent, GUEST_HELPER_SHA256, GUEST_ASSETS_BASE_URL, GUEST_KERNEL_SHA256, JAILER_BINARY_SHA256, FIRECRACKER_BINARY_SHA256, FIRECRACKER_SHA256, GUEST_ASSETS_VERSION, BUILDER_DISK_VERSION, credentialHandOffKey, strippedVariables, runnerAgents, judgeAgent, networkHelperPinned, NETWORK_HELPER_SHA256, universalImagePinned, UNIVERSAL_IMAGE, FFMPEG_STATIC, FFMPEG_BUILD_TAG, GH_SHA256, GH_VERSION, TINI_SHA256, TINI_VERSION, HEADLESS_SHELL, HEADLESS_SHELL_BASE_URL, PLAYWRIGHT_FFMPEG, PLAYWRIGHT_FFMPEG_BASE_URL, VOICE_PACK_FILES, BUILDER_DISK_SHA256, BUILDER_DISK_BASE_URL, DEFAULT_BASE_IMAGE, agentVersionOf } from './chunk-IEX5FXEU.js';
|
|
38
|
+
import { sessionFolderIn, legacyAgent, defaultAgents, parsePolicy, AGENTS_SKILLS_BASE, OUTERLAYER_SKILLS_BASE, orderSessions, extractFacts, sessionsToTimeline, resolvePackRoot } from './chunk-G2CRPYFO.js';
|
|
39
39
|
import { MAINTAINED_SKILLS } from './chunk-ATEMEVFF.js';
|
|
40
40
|
import { resolveVersion } from './chunk-RA3O54FC.js';
|
|
41
41
|
import { homeFromEnv } from './chunk-352DHUTP.js';
|
|
42
|
-
import { scrubText, MIN_SCRUBBED_LITERAL, setCustomScrubbers, setLocalIdentity, setRepoRoot, forkFor, scrubDeep } from './chunk-
|
|
43
|
-
import { CheckItemsSchema, CODE_REVIEW_NAME, JUDGE_NOT_RUN_ITEM_ID, REVIEWED_COMMIT_ITEM_ID, CHECK_ITEM_REASON_MAX_LENGTH, UNREVIEWED_FILES_ITEM_ID, CHECK_ITEM_HREF_MAX_LENGTH, downconvertSession } from './chunk-
|
|
42
|
+
import { scrubText, MIN_SCRUBBED_LITERAL, setCustomScrubbers, setLocalIdentity, setRepoRoot, forkFor, scrubDeep } from './chunk-E5G6K7C4.js';
|
|
43
|
+
import { CheckItemsSchema, CODE_REVIEW_NAME, JUDGE_NOT_RUN_ITEM_ID, REVIEWED_COMMIT_ITEM_ID, CHECK_ITEM_REASON_MAX_LENGTH, UNREVIEWED_FILES_ITEM_ID, CHECK_ITEM_HREF_MAX_LENGTH, downconvertSession } from './chunk-NEXKR5RR.js';
|
|
44
44
|
import { randomUUID, randomBytes, createHash } from 'crypto';
|
|
45
|
-
import { rmSync, mkdirSync, existsSync, readFileSync, mkdtempSync, statSync, appendFileSync, writeFileSync, readdirSync, accessSync, constants, openSync, closeSync, renameSync, rmdirSync,
|
|
45
|
+
import { rmSync, mkdirSync, existsSync, readFileSync, mkdtempSync, statSync, appendFileSync, writeFileSync, readdirSync, accessSync, constants, openSync, closeSync, renameSync, rmdirSync, createReadStream, lstatSync, unlinkSync, chmodSync, realpathSync, writeSync, truncateSync, cpSync, fstatSync, readSync, createWriteStream, copyFileSync, linkSync } from 'fs';
|
|
46
46
|
import { join, dirname, isAbsolute, delimiter, basename, sep, relative, resolve } from 'path';
|
|
47
|
-
import {
|
|
47
|
+
import { Readable, PassThrough, Duplex, Transform, Writable } from 'stream';
|
|
48
48
|
import { spawn, spawnSync } from 'child_process';
|
|
49
49
|
import { createServer, createConnection, connect, isIP } from 'net';
|
|
50
50
|
import { availableParallelism, networkInterfaces, tmpdir } from 'os';
|
|
51
|
-
import {
|
|
51
|
+
import { createGunzip, gunzipSync, constants as constants$1, gzipSync } from 'zlib';
|
|
52
52
|
import http2 from 'http2';
|
|
53
53
|
import { once } from 'events';
|
|
54
54
|
import { createServer as createServer$1, request, Agent } from 'http';
|
|
@@ -3492,6 +3492,422 @@ function recordingCause(log) {
|
|
|
3492
3492
|
const cause = proof ?? lines.find((line2) => line2.startsWith("setup failed: "));
|
|
3493
3493
|
return cause === void 0 ? void 0 : cause.slice(0, MAX_CAUSE_LENGTH);
|
|
3494
3494
|
}
|
|
3495
|
+
function savedStatesDir(runnerDirPath) {
|
|
3496
|
+
return join(runnerDirPath, "saved-states");
|
|
3497
|
+
}
|
|
3498
|
+
function writeRecord2(dir, record) {
|
|
3499
|
+
mkdirSync(dir, { recursive: true, mode: RUNNER_DIR_MODE });
|
|
3500
|
+
const target2 = join(dir, `${record.id}.json`);
|
|
3501
|
+
const partial = `${target2}.partial`;
|
|
3502
|
+
writeFileSync(partial, `${JSON.stringify(record, null, 2)}
|
|
3503
|
+
`, { mode: RUNNER_FILE_MODE });
|
|
3504
|
+
renameSync(partial, target2);
|
|
3505
|
+
}
|
|
3506
|
+
function isRecord(value) {
|
|
3507
|
+
if (typeof value !== "object" || value === null) return false;
|
|
3508
|
+
const r = value;
|
|
3509
|
+
return typeof r.id === "string" && (r.kind === "volume" || r.kind === "tar" || r.kind === "disk") && typeof r.savedAt === "string" && Number.isFinite(Date.parse(r.savedAt)) && typeof r.bytes === "number" && typeof r.baseKey === "string" && typeof r.key === "string" && typeof r.fileHashes === "object" && r.fileHashes !== null && typeof r.complete === "boolean";
|
|
3510
|
+
}
|
|
3511
|
+
function readRecords(dir) {
|
|
3512
|
+
let names;
|
|
3513
|
+
try {
|
|
3514
|
+
names = readdirSync(dir);
|
|
3515
|
+
} catch {
|
|
3516
|
+
return [];
|
|
3517
|
+
}
|
|
3518
|
+
const records = [];
|
|
3519
|
+
for (const name of names) {
|
|
3520
|
+
if (!name.endsWith(".json")) continue;
|
|
3521
|
+
try {
|
|
3522
|
+
const parsed = JSON.parse(readFileSync(join(dir, name), "utf8"));
|
|
3523
|
+
if (isRecord(parsed)) records.push(parsed);
|
|
3524
|
+
} catch {
|
|
3525
|
+
}
|
|
3526
|
+
}
|
|
3527
|
+
return records;
|
|
3528
|
+
}
|
|
3529
|
+
function deleteRecord(dir, id) {
|
|
3530
|
+
rmSync(join(dir, `${id}.json`), { force: true });
|
|
3531
|
+
}
|
|
3532
|
+
|
|
3533
|
+
// src/runner/saved-state/container.ts
|
|
3534
|
+
var SAVED_FOLDERS = ["home", "work"];
|
|
3535
|
+
function stopProcessesScript() {
|
|
3536
|
+
return [
|
|
3537
|
+
"me=$$; uid=$(id -u); n=0; pass=0",
|
|
3538
|
+
"while [ $pass -lt 25 ]; do",
|
|
3539
|
+
' left=""',
|
|
3540
|
+
" for p in /proc/[0-9]*; do",
|
|
3541
|
+
" pid=${p##*/}",
|
|
3542
|
+
' [ "$pid" = "$me" ] && continue',
|
|
3543
|
+
` info=$(sed -n -e 's/^State:[[:space:]]*\\(.\\).*/S=\\1/p' -e 's/^Uid:[[:space:]]*\\([0-9]*\\).*/U=\\1/p' "$p/status" 2>/dev/null) || continue`,
|
|
3544
|
+
' case "$info" in *"S=Z"*) continue ;; esac',
|
|
3545
|
+
// The uid is the last line of `info`, so a match at its end cannot be the longer id 10000 for 1000.
|
|
3546
|
+
' case "$info" in *"U=$uid") left="$left $pid" ;; esac',
|
|
3547
|
+
" done",
|
|
3548
|
+
' [ -z "$left" ] && break',
|
|
3549
|
+
' for pid in $left; do kill -KILL "$pid" 2>/dev/null && n=$((n+1)); done',
|
|
3550
|
+
" pass=$((pass+1))",
|
|
3551
|
+
" sleep 0.2",
|
|
3552
|
+
"done",
|
|
3553
|
+
'[ -z "$left" ] || { echo "$left are still running" >&2; exit 1; }',
|
|
3554
|
+
'echo "stopped $n"'
|
|
3555
|
+
].join("\n");
|
|
3556
|
+
}
|
|
3557
|
+
var HELPER_FLAGS = [
|
|
3558
|
+
"--rm",
|
|
3559
|
+
"--network",
|
|
3560
|
+
"none",
|
|
3561
|
+
"--cap-drop",
|
|
3562
|
+
"ALL",
|
|
3563
|
+
"--cap-add",
|
|
3564
|
+
"CHOWN",
|
|
3565
|
+
"--cap-add",
|
|
3566
|
+
"DAC_OVERRIDE",
|
|
3567
|
+
"--cap-add",
|
|
3568
|
+
"DAC_READ_SEARCH",
|
|
3569
|
+
"--cap-add",
|
|
3570
|
+
"FOWNER",
|
|
3571
|
+
"--security-opt",
|
|
3572
|
+
"no-new-privileges",
|
|
3573
|
+
"--read-only",
|
|
3574
|
+
"--user",
|
|
3575
|
+
"0",
|
|
3576
|
+
"--pids-limit",
|
|
3577
|
+
"256"
|
|
3578
|
+
];
|
|
3579
|
+
function helperArgs(input) {
|
|
3580
|
+
return [
|
|
3581
|
+
...HELPER_FLAGS,
|
|
3582
|
+
"--label",
|
|
3583
|
+
`${RUNNER_LABEL}=${input.runnerId}`,
|
|
3584
|
+
"--mount",
|
|
3585
|
+
`type=volume,src=${input.from},dst=/from,readonly`,
|
|
3586
|
+
"--mount",
|
|
3587
|
+
`type=volume,src=${input.to},dst=/to`,
|
|
3588
|
+
"--entrypoint",
|
|
3589
|
+
"sh",
|
|
3590
|
+
input.image,
|
|
3591
|
+
"-c",
|
|
3592
|
+
input.script
|
|
3593
|
+
];
|
|
3594
|
+
}
|
|
3595
|
+
var ONE_BUILD_FOLDERS = ["tmp", ".command"];
|
|
3596
|
+
function clearOneBuildArgs(input) {
|
|
3597
|
+
return [
|
|
3598
|
+
...HELPER_FLAGS,
|
|
3599
|
+
"--label",
|
|
3600
|
+
`${RUNNER_LABEL}=${input.runnerId}`,
|
|
3601
|
+
"--mount",
|
|
3602
|
+
`type=volume,src=${input.volume},dst=/build`,
|
|
3603
|
+
"--entrypoint",
|
|
3604
|
+
"sh",
|
|
3605
|
+
input.image,
|
|
3606
|
+
"-c",
|
|
3607
|
+
`rm -rf ${ONE_BUILD_FOLDERS.map((name) => `/build/${name}`).join(" ")}`
|
|
3608
|
+
];
|
|
3609
|
+
}
|
|
3610
|
+
var SAVE_SCRIPT = `set -e; cp -a ${SAVED_FOLDERS.map((name) => `/from/${name}`).join(" ")} /to/; du -sk /to | cut -f1`;
|
|
3611
|
+
var RESTORE_SCRIPT = `set -e; cp -a ${SAVED_FOLDERS.map((name) => `/from/${name}`).join(" ")} /to/`;
|
|
3612
|
+
function failureText(result) {
|
|
3613
|
+
const line2 = result.stderr.trim().split("\n").at(-1) ?? "";
|
|
3614
|
+
return `exit ${result.status}${line2 === "" ? "" : `: ${line2}`}`;
|
|
3615
|
+
}
|
|
3616
|
+
async function saveContainerState(input) {
|
|
3617
|
+
const { host } = input;
|
|
3618
|
+
const id = randomBytes(6).toString("hex");
|
|
3619
|
+
const volume = `outerlayer-saved-${id}`;
|
|
3620
|
+
const record = {
|
|
3621
|
+
id,
|
|
3622
|
+
kind: "volume",
|
|
3623
|
+
volume,
|
|
3624
|
+
savedAt: input.now.toISOString(),
|
|
3625
|
+
bytes: 0,
|
|
3626
|
+
baseKey: input.key.baseKey,
|
|
3627
|
+
key: input.key.key,
|
|
3628
|
+
fileHashes: input.key.fileHashes,
|
|
3629
|
+
...input.agentUid === void 0 ? {} : { agentUid: input.agentUid },
|
|
3630
|
+
complete: false
|
|
3631
|
+
};
|
|
3632
|
+
const discard = async (reason) => {
|
|
3633
|
+
const removed = await host.removeVolume(volume).catch((err) => ({ status: -1, stderr: describeCallFailure(err) }));
|
|
3634
|
+
if (removed.status !== 0) {
|
|
3635
|
+
input.log(`the volume ${volume} could not be removed (${failureText({ status: removed.status, stderr: removed.stderr })}); its record stays so a later pass retries`);
|
|
3636
|
+
return { ok: false, reason };
|
|
3637
|
+
}
|
|
3638
|
+
deleteRecord(input.dir, id);
|
|
3639
|
+
return { ok: false, reason };
|
|
3640
|
+
};
|
|
3641
|
+
try {
|
|
3642
|
+
const noEnv = { literals: {}, passed: {} };
|
|
3643
|
+
const stopped = await host.exec({ container: input.container, user: input.agentUser, env: noEnv, argv: ["sh", "-c", stopProcessesScript()] });
|
|
3644
|
+
if (stopped.status !== 0) return { ok: false, reason: `the build's processes could not be stopped (${failureText(stopped)})` };
|
|
3645
|
+
input.log(`${stopped.stdout.trim() || "stopped 0"} process${stopped.stdout.trim() === "stopped 1" ? "" : "es"} before saving the state`);
|
|
3646
|
+
const flushed = await host.exec({ container: input.container, user: input.agentUser, env: noEnv, argv: ["sync"] });
|
|
3647
|
+
if (flushed.status !== 0) return { ok: false, reason: `the build's disk could not be flushed (${failureText(flushed)})` };
|
|
3648
|
+
writeRecord2(input.dir, record);
|
|
3649
|
+
const created = await host.createVolume(volume, { [SAVED_STATE_LABEL]: id, [RUNNER_LABEL]: input.runnerId });
|
|
3650
|
+
if (created.status !== 0) return await discard(`the volume for the saved state could not be made (${failureText(created)})`);
|
|
3651
|
+
const copied = await host.run(helperArgs({ image: input.image, from: input.buildVolume, to: volume, script: SAVE_SCRIPT, runnerId: input.runnerId }), { logPath: input.logPath });
|
|
3652
|
+
if (copied.status !== 0) return await discard(`the copy into the saved state failed (${failureText(copied)})`);
|
|
3653
|
+
const kilobytes = Number(copied.stdout.trim().split("\n").at(-1));
|
|
3654
|
+
const done = { ...record, bytes: Number.isFinite(kilobytes) ? kilobytes * 1024 : 0, complete: true };
|
|
3655
|
+
writeRecord2(input.dir, done);
|
|
3656
|
+
return { ok: true, record: done };
|
|
3657
|
+
} catch (err) {
|
|
3658
|
+
return await discard(`the state could not be saved: ${describeCallFailure(err)}`);
|
|
3659
|
+
}
|
|
3660
|
+
}
|
|
3661
|
+
async function restoreContainerState(input) {
|
|
3662
|
+
try {
|
|
3663
|
+
const copied = await input.host.run(helperArgs({ image: input.image, from: input.savedVolume, to: input.targetVolume, script: RESTORE_SCRIPT, runnerId: input.runnerId }), { logPath: input.logPath });
|
|
3664
|
+
if (copied.status !== 0) return { ok: false, reason: `the saved volume could not be copied (${failureText(copied)})` };
|
|
3665
|
+
return { ok: true };
|
|
3666
|
+
} catch (err) {
|
|
3667
|
+
return { ok: false, reason: `the saved volume could not be copied: ${describeCallFailure(err)}` };
|
|
3668
|
+
}
|
|
3669
|
+
}
|
|
3670
|
+
async function removeSavedState(record, deps) {
|
|
3671
|
+
if (record.kind === "volume" && record.volume !== void 0) {
|
|
3672
|
+
const result = await deps.removeVolume(record.volume);
|
|
3673
|
+
if (result !== void 0 && result.status !== 0) {
|
|
3674
|
+
const line2 = (result.stderr ?? "").trim().split("\n").filter((text2) => text2.trim() !== "").at(-1);
|
|
3675
|
+
throw new Error(`Docker could not remove volume ${record.volume} (exit ${result.status}${line2 === void 0 ? "" : `: ${line2}`})`);
|
|
3676
|
+
}
|
|
3677
|
+
}
|
|
3678
|
+
if ((record.kind === "tar" || record.kind === "disk") && record.path !== void 0) {
|
|
3679
|
+
rmSync(`${record.path}.partial`, { force: true });
|
|
3680
|
+
rmSync(record.path, { force: true });
|
|
3681
|
+
}
|
|
3682
|
+
deleteRecord(deps.dir, record.id);
|
|
3683
|
+
}
|
|
3684
|
+
async function removeOldestUntil(input) {
|
|
3685
|
+
const removed = [];
|
|
3686
|
+
for (const record of oldestFirst(input.records)) {
|
|
3687
|
+
if (input.enough()) break;
|
|
3688
|
+
try {
|
|
3689
|
+
await removeSavedState(record, input.deps);
|
|
3690
|
+
removed.push(record);
|
|
3691
|
+
input.log(`removed saved state ${record.id} from ${record.savedAt}`);
|
|
3692
|
+
} catch (err) {
|
|
3693
|
+
input.log(`could not remove saved state ${record.id}: ${describeCallFailure(err)}`);
|
|
3694
|
+
}
|
|
3695
|
+
}
|
|
3696
|
+
return removed;
|
|
3697
|
+
}
|
|
3698
|
+
async function removeSuperseded(input) {
|
|
3699
|
+
for (const old of input.records.filter((record) => record.complete && record.key === input.made.key && record.id !== input.made.id && Date.parse(record.savedAt) < Date.parse(input.made.savedAt))) {
|
|
3700
|
+
try {
|
|
3701
|
+
await removeSavedState(old, input.deps);
|
|
3702
|
+
input.log(`removed saved state ${old.id}, saved state ${input.made.id} replaces it`);
|
|
3703
|
+
} catch (err) {
|
|
3704
|
+
input.log(`could not remove saved state ${old.id}: ${describeCallFailure(err)}`);
|
|
3705
|
+
}
|
|
3706
|
+
}
|
|
3707
|
+
}
|
|
3708
|
+
var RECORD_FILE = "record.json";
|
|
3709
|
+
var DISK_FILE = "disk.ext4";
|
|
3710
|
+
var WORK_ITEM_ID2 = /^[A-Za-z0-9_-]{1,64}$/;
|
|
3711
|
+
function itemDiskDir(configPath, organizationId, workItemId) {
|
|
3712
|
+
if (!WORK_ITEM_ID2.test(workItemId)) throw new Error(`cannot keep a disk for the work item ${JSON.stringify(workItemId)}`);
|
|
3713
|
+
return join(workspacesDir(configPath, organizationId), workItemId);
|
|
3714
|
+
}
|
|
3715
|
+
function isRecord2(value) {
|
|
3716
|
+
if (typeof value !== "object" || value === null) return false;
|
|
3717
|
+
const r = value;
|
|
3718
|
+
return typeof r.workItemId === "string" && typeof r.claimId === "string" && typeof r.queue === "string" && typeof r.imageId === "string" && typeof r.diskBytes === "number" && (r.kind === "disk" || r.kind === "volume" && typeof r.volume === "string" || r.kind === "sandbox" && typeof r.volume === "string" && typeof r.snapshot === "string") && typeof r.bytes === "number" && typeof r.keptAt === "string" && Number.isFinite(Date.parse(r.keptAt));
|
|
3719
|
+
}
|
|
3720
|
+
function readItemDisk(dir) {
|
|
3721
|
+
let parsed;
|
|
3722
|
+
try {
|
|
3723
|
+
parsed = JSON.parse(readFileSync(join(dir, RECORD_FILE), "utf8"));
|
|
3724
|
+
} catch {
|
|
3725
|
+
return void 0;
|
|
3726
|
+
}
|
|
3727
|
+
if (!isRecord2(parsed) || parsed.workItemId !== basename(dir)) return void 0;
|
|
3728
|
+
if (parsed.kind !== "disk") return { dir, record: parsed };
|
|
3729
|
+
const path = join(dir, DISK_FILE);
|
|
3730
|
+
try {
|
|
3731
|
+
if (!statSync(path).isFile()) return void 0;
|
|
3732
|
+
} catch {
|
|
3733
|
+
return void 0;
|
|
3734
|
+
}
|
|
3735
|
+
return { dir, record: parsed, path };
|
|
3736
|
+
}
|
|
3737
|
+
function swapInItemDisk(dir, incoming) {
|
|
3738
|
+
const older = readItemDisk(dir);
|
|
3739
|
+
const outgoing = join(dirname(dir), `.${basename(dir)}.${randomBytes(4).toString("hex")}.old`);
|
|
3740
|
+
let hadOlder = true;
|
|
3741
|
+
try {
|
|
3742
|
+
renameSync(dir, outgoing);
|
|
3743
|
+
} catch (err) {
|
|
3744
|
+
if (err.code !== "ENOENT") throw err;
|
|
3745
|
+
hadOlder = false;
|
|
3746
|
+
}
|
|
3747
|
+
try {
|
|
3748
|
+
renameSync(incoming, dir);
|
|
3749
|
+
} catch (err) {
|
|
3750
|
+
if (hadOlder) renameSync(outgoing, dir);
|
|
3751
|
+
throw err;
|
|
3752
|
+
}
|
|
3753
|
+
rmSync(outgoing, { recursive: true, force: true });
|
|
3754
|
+
return older;
|
|
3755
|
+
}
|
|
3756
|
+
function stagingItemDiskDir(dir) {
|
|
3757
|
+
const parent = dirname(dir);
|
|
3758
|
+
mkdirSync(parent, { recursive: true, mode: 448 });
|
|
3759
|
+
const staging = join(parent, `.${basename(dir)}.${randomBytes(4).toString("hex")}.partial`);
|
|
3760
|
+
mkdirSync(staging, { mode: 448 });
|
|
3761
|
+
return staging;
|
|
3762
|
+
}
|
|
3763
|
+
function listItemDisks(configPath, scope) {
|
|
3764
|
+
const where = workspacesDir(configPath, scope);
|
|
3765
|
+
let names;
|
|
3766
|
+
try {
|
|
3767
|
+
names = readdirSync(where);
|
|
3768
|
+
} catch {
|
|
3769
|
+
return [];
|
|
3770
|
+
}
|
|
3771
|
+
const kept = [];
|
|
3772
|
+
for (const name of names) {
|
|
3773
|
+
if (!WORK_ITEM_ID2.test(name)) continue;
|
|
3774
|
+
const found = readItemDisk(join(where, name));
|
|
3775
|
+
if (found !== void 0) kept.push(found);
|
|
3776
|
+
}
|
|
3777
|
+
return kept;
|
|
3778
|
+
}
|
|
3779
|
+
function listLeftovers(configPath, scope) {
|
|
3780
|
+
const where = workspacesDir(configPath, scope);
|
|
3781
|
+
let names;
|
|
3782
|
+
try {
|
|
3783
|
+
names = readdirSync(where);
|
|
3784
|
+
} catch {
|
|
3785
|
+
return [];
|
|
3786
|
+
}
|
|
3787
|
+
const found = [];
|
|
3788
|
+
for (const name of names) {
|
|
3789
|
+
if (!name.startsWith(".") && (!WORK_ITEM_ID2.test(name) || readItemDisk(join(where, name)) !== void 0)) continue;
|
|
3790
|
+
try {
|
|
3791
|
+
found.push({ path: join(where, name), mtimeMs: lstatSync(join(where, name)).mtimeMs });
|
|
3792
|
+
} catch {
|
|
3793
|
+
}
|
|
3794
|
+
}
|
|
3795
|
+
return found;
|
|
3796
|
+
}
|
|
3797
|
+
|
|
3798
|
+
// src/runner/workspace/restore.ts
|
|
3799
|
+
var DISK_REASON_TEXT = {
|
|
3800
|
+
no_kept_disk: "no disk is kept for the work item on this host",
|
|
3801
|
+
other_image: "the kept disk was made on another image",
|
|
3802
|
+
other_disk_size: "the kept disk was made with another runner.build.disk size",
|
|
3803
|
+
disk_not_restored: "the kept disk could not be copied",
|
|
3804
|
+
checkout_not_switched: "the kept checkout could not be switched to the branch",
|
|
3805
|
+
build_type_cannot_restore: "this build type cannot restore a disk",
|
|
3806
|
+
fresh_requested: "a member asked for a fresh disk",
|
|
3807
|
+
holder_busy: "the machine that holds its disk was busy"
|
|
3808
|
+
};
|
|
3809
|
+
function itemDiskDecision(input) {
|
|
3810
|
+
if (input.fresh === true) return { state: { restored: false, reason: "fresh_requested" } };
|
|
3811
|
+
if (!input.builtin) return { state: { restored: false, reason: "build_type_cannot_restore" } };
|
|
3812
|
+
let kept;
|
|
3813
|
+
try {
|
|
3814
|
+
kept = readItemDisk(itemDiskDir(input.configPath, input.organizationId, input.workItemId));
|
|
3815
|
+
} catch {
|
|
3816
|
+
kept = void 0;
|
|
3817
|
+
}
|
|
3818
|
+
if (kept === void 0) return { state: { restored: false, reason: input.heldElsewhere === true ? "holder_busy" : "no_kept_disk" } };
|
|
3819
|
+
if (kept.record.repository !== input.repository) return { state: { restored: false, reason: "no_kept_disk" } };
|
|
3820
|
+
if (kept.record.imageId !== input.imageId) return { state: { restored: false, reason: "other_image" } };
|
|
3821
|
+
if (kept.record.diskBytes !== input.diskBytes) return { state: { restored: false, reason: "other_disk_size" } };
|
|
3822
|
+
if (kept.record.kind !== input.backend) return { state: { restored: false, reason: "disk_not_restored" } };
|
|
3823
|
+
return { kept, state: { restored: true, fromClaimId: kept.record.claimId } };
|
|
3824
|
+
}
|
|
3825
|
+
async function discardItemDisk(kept, removeVolume, onError, removeSnapshot) {
|
|
3826
|
+
try {
|
|
3827
|
+
if (kept.record.snapshot !== void 0) {
|
|
3828
|
+
if (removeSnapshot === void 0) return onError(`could not remove the snapshot ${kept.record.snapshot} of the kept disk: no sandbox provider is set`);
|
|
3829
|
+
await removeSnapshot(kept.record.snapshot);
|
|
3830
|
+
}
|
|
3831
|
+
if (kept.record.kind === "volume" && kept.record.volume !== void 0) {
|
|
3832
|
+
const removed = await removeVolume(kept.record.volume);
|
|
3833
|
+
if (removed !== void 0 && removed.status !== 0 && !/no such volume/i.test(removed.stderr ?? "")) {
|
|
3834
|
+
onError(`could not remove the volume ${kept.record.volume} of the kept disk: ${removed.stderr?.trim() ?? `exit ${removed.status}`}`);
|
|
3835
|
+
return;
|
|
3836
|
+
}
|
|
3837
|
+
}
|
|
3838
|
+
rmSync(kept.dir, { recursive: true, force: true });
|
|
3839
|
+
} catch (err) {
|
|
3840
|
+
onError(`could not remove the kept disk of work item ${kept.record.workItemId}: ${describeCallFailure(err)}`);
|
|
3841
|
+
}
|
|
3842
|
+
}
|
|
3843
|
+
|
|
3844
|
+
// src/runner/saved-state/provision.ts
|
|
3845
|
+
var isRetryFresh = (value) => typeof value === "object" && value !== null && value.retryFresh === true;
|
|
3846
|
+
async function provisionWithFreshFallback(input) {
|
|
3847
|
+
const first = await input.attempt(true);
|
|
3848
|
+
if (!isRetryFresh(first)) return first;
|
|
3849
|
+
input.log(`${first.reason}; provisioning the build again from a fresh disk`);
|
|
3850
|
+
if (first.itemDisk === void 0) return await input.attempt(false);
|
|
3851
|
+
const second = await input.attempt(true, first.itemDisk);
|
|
3852
|
+
if (!isRetryFresh(second)) return second;
|
|
3853
|
+
input.log(`${second.reason}; provisioning the build again from a fresh disk`);
|
|
3854
|
+
return await input.attempt(false, first.itemDisk);
|
|
3855
|
+
}
|
|
3856
|
+
function keptDiskPlan() {
|
|
3857
|
+
return { keyCommits: {}, noSave: "it starts from the work item's kept disk" };
|
|
3858
|
+
}
|
|
3859
|
+
function clockOf(now) {
|
|
3860
|
+
return now ?? (() => /* @__PURE__ */ new Date());
|
|
3861
|
+
}
|
|
3862
|
+
function taggedLog(log, tag) {
|
|
3863
|
+
return (line2) => log.line(`${tag} ${line2}`);
|
|
3864
|
+
}
|
|
3865
|
+
function uidFromProbe(probe) {
|
|
3866
|
+
const uid = Number(probe.stdout);
|
|
3867
|
+
return probe.status === 0 && Number.isInteger(uid) ? uid : null;
|
|
3868
|
+
}
|
|
3869
|
+
function agentUidOf(probe) {
|
|
3870
|
+
return uidFromProbe(probe) ?? void 0;
|
|
3871
|
+
}
|
|
3872
|
+
function userIdChangedReason(savedUid, agentUid) {
|
|
3873
|
+
if (savedUid === void 0 || agentUid === savedUid) return void 0;
|
|
3874
|
+
return `the build user's id is ${agentUid ?? "unknown"} and it was ${savedUid} when the state was saved`;
|
|
3875
|
+
}
|
|
3876
|
+
function setupInputFor(input) {
|
|
3877
|
+
const minutes = input.setupMinutes ?? DEFAULT_SETUP_MINUTES;
|
|
3878
|
+
return {
|
|
3879
|
+
timeoutMs: minutes * 6e4,
|
|
3880
|
+
limitMinutes: minutes,
|
|
3881
|
+
restored: input.plan.restore !== void 0 || input.fromItemDisk === true,
|
|
3882
|
+
...input.fromItemDisk === true ? { fromItemDisk: true } : {},
|
|
3883
|
+
keyCommits: input.plan.keyCommits,
|
|
3884
|
+
...input.withoutBuildVariables === true ? { withoutBuildVariables: true } : {},
|
|
3885
|
+
// A plan has a key exactly when the build may save a state. A build that starts from one is not asked to save.
|
|
3886
|
+
...input.plan.key === void 0 ? {} : { saveState: input.saveState }
|
|
3887
|
+
};
|
|
3888
|
+
}
|
|
3889
|
+
async function saveAndPrune(input) {
|
|
3890
|
+
const made = await input.save();
|
|
3891
|
+
if (!made.ok) return made;
|
|
3892
|
+
input.log(`saved state ${made.record.id}`);
|
|
3893
|
+
await removeSuperseded({ made: made.record, records: readRecords(input.dir), deps: { dir: input.dir, removeVolume: input.removeVolume }, log: input.log });
|
|
3894
|
+
return { ok: true };
|
|
3895
|
+
}
|
|
3896
|
+
async function discardUnusableState(input) {
|
|
3897
|
+
try {
|
|
3898
|
+
await removeSavedState(input.record, { dir: input.dir, removeVolume: input.removeVolume });
|
|
3899
|
+
} catch (err) {
|
|
3900
|
+
input.onError(`could not remove saved state ${input.record.id}: ${describeCallFailure(err)}`);
|
|
3901
|
+
}
|
|
3902
|
+
return { retryFresh: true, reason: `saved state ${input.record.id} could not be used: ${input.reason}` };
|
|
3903
|
+
}
|
|
3904
|
+
function settleFailedSteps(steps, on) {
|
|
3905
|
+
return steps.restoreFailed === true ? on.giveUp(steps.reason, steps.fromItemDisk === true) : on.bail(steps.reason, steps.aborted === true);
|
|
3906
|
+
}
|
|
3907
|
+
async function discardUnusableItemDisk(input) {
|
|
3908
|
+
await discardItemDisk(input.kept, input.removeVolume, input.onError, input.removeSnapshot);
|
|
3909
|
+
return { retryFresh: true, reason: `the kept disk of claim ${shortClaim(input.kept.record.claimId)} could not be used: ${input.reason}`, itemDisk: input.why };
|
|
3910
|
+
}
|
|
3495
3911
|
|
|
3496
3912
|
// src/runner/sandbox/sweep.ts
|
|
3497
3913
|
var RUNNER_METADATA = "outerlayerRunner";
|
|
@@ -3685,6 +4101,7 @@ function sandboxHost(client2, sandbox, options = {}) {
|
|
|
3685
4101
|
// src/runner/sandbox/hooks.ts
|
|
3686
4102
|
var SANDBOX_DIR = "/tmp/ol";
|
|
3687
4103
|
var CLI_DIR = `${SANDBOX_DIR}/dist`;
|
|
4104
|
+
var SKILL_PACK_DIR = `${SANDBOX_DIR}/skill-pack`;
|
|
3688
4105
|
var SECRET_FILE = `${SANDBOX_DIR}/join-secret`;
|
|
3689
4106
|
var CONTAINER_SECRET_FILE = "/run/outerlayer-relay/join-secret";
|
|
3690
4107
|
var JOIN_WS_PORT = 7077;
|
|
@@ -3698,6 +4115,13 @@ function sandboxNameOf(runnerLabel, buildId) {
|
|
|
3698
4115
|
const short = runnerLabel.toLowerCase().replace(/[^a-z0-9]/g, "").slice(0, 8);
|
|
3699
4116
|
return `ol-${short === "" ? "runner" : short}-${buildId}`;
|
|
3700
4117
|
}
|
|
4118
|
+
function itemSnapshotName(runnerLabel, part = randomBytes(6).toString("hex")) {
|
|
4119
|
+
return sandboxNameOf(runnerLabel, `disk-${part}`);
|
|
4120
|
+
}
|
|
4121
|
+
function diskImageOf(own) {
|
|
4122
|
+
return `${own.snapshot}/${own.image}`;
|
|
4123
|
+
}
|
|
4124
|
+
var GIB2 = 1024 ** 3;
|
|
3701
4125
|
async function endUnansweredSandbox(sandboxClient, runnerId, buildId, warn) {
|
|
3702
4126
|
try {
|
|
3703
4127
|
for (const found of await sandboxClient.list()) {
|
|
@@ -3746,7 +4170,7 @@ async function goneReason(runtime, state) {
|
|
|
3746
4170
|
return err instanceof SandboxError && err.status === 404 ? new SandboxGoneError(state.sandboxId) : void 0;
|
|
3747
4171
|
}
|
|
3748
4172
|
}
|
|
3749
|
-
function sandboxRunArgs(args) {
|
|
4173
|
+
function sandboxRunArgs(args, opts = {}) {
|
|
3750
4174
|
const out = [...args];
|
|
3751
4175
|
const network = out.indexOf("--network");
|
|
3752
4176
|
if (network !== -1) out[network + 1] = "host";
|
|
@@ -3756,6 +4180,7 @@ function sandboxRunArgs(args) {
|
|
|
3756
4180
|
0,
|
|
3757
4181
|
"--mount",
|
|
3758
4182
|
`type=bind,src=${CLI_DIR},dst=/opt/outerlayer/cli/dist,readonly`,
|
|
4183
|
+
...opts.skillPack === true ? ["--mount", `type=bind,src=${SKILL_PACK_DIR},dst=/opt/outerlayer/cli/skill-pack,readonly`] : [],
|
|
3759
4184
|
"--mount",
|
|
3760
4185
|
`type=bind,src=${SECRET_FILE},dst=${CONTAINER_SECRET_FILE},readonly`,
|
|
3761
4186
|
...Object.entries(toolProxyEnvironment()).flatMap(([name, value]) => ["--env", `${name}=${value}`])
|
|
@@ -3772,7 +4197,38 @@ async function waitForRelay(runtime, container) {
|
|
|
3772
4197
|
}
|
|
3773
4198
|
return false;
|
|
3774
4199
|
}
|
|
3775
|
-
|
|
4200
|
+
function joinRelay(runtime, sandbox, build, services, joinSecret, log) {
|
|
4201
|
+
const exec = sandboxExecStream({
|
|
4202
|
+
url: () => client(runtime).portUrl(sandbox, JOIN_WS_PORT),
|
|
4203
|
+
secret: joinSecret,
|
|
4204
|
+
...runtime.sandbox.webSocket === void 0 ? {} : { webSocket: runtime.sandbox.webSocket }
|
|
4205
|
+
});
|
|
4206
|
+
runtime.relays.set(
|
|
4207
|
+
build.buildId,
|
|
4208
|
+
superviseRelay({
|
|
4209
|
+
container: build.container,
|
|
4210
|
+
services,
|
|
4211
|
+
execStream: () => exec(),
|
|
4212
|
+
...log === void 0 ? {} : { log },
|
|
4213
|
+
onFatal: (reason) => runtime.relayFatal.set(build.buildId, reason),
|
|
4214
|
+
builtIns: builtInNames(runtime.agents)
|
|
4215
|
+
})
|
|
4216
|
+
);
|
|
4217
|
+
}
|
|
4218
|
+
var SANDBOX_RUN_DIR = "/tmp/ol-run";
|
|
4219
|
+
async function keepSandboxDisk(runtime, state, kept) {
|
|
4220
|
+
const sandbox = await sandboxOfBuild(runtime, state);
|
|
4221
|
+
if (sandbox === void 0) throw new Error(`sandbox ${state.sandboxId} is gone`);
|
|
4222
|
+
const { host } = runtimeInSandbox(runtime, sandbox);
|
|
4223
|
+
const removed = await host.remove(kept.container);
|
|
4224
|
+
if (removed.status !== 0 && !/no such container/i.test(removed.stderr)) throw new Error(`container ${kept.container} was not removed${said(removed.stderr)}`);
|
|
4225
|
+
const emptied = await host.run(clearOneBuildArgs({ image: kept.imageId, volume: kept.volume, runnerId: kept.runnerId }));
|
|
4226
|
+
if (emptied.status !== 0) throw new Error(`the build's command state was not removed from the volume (exit ${emptied.status})${said(emptied.stderr)}`);
|
|
4227
|
+
const cleared = await client(runtime).command(sandbox, `sudo rm -rf ${SANDBOX_DIR} ${SANDBOX_RUN_DIR}`);
|
|
4228
|
+
if (cleared.exitCode !== 0) throw new Error(`the runner's files were not removed from the sandbox (exit ${cleared.exitCode ?? "none"})${said(cleared.stderr)}`);
|
|
4229
|
+
await kept.keep();
|
|
4230
|
+
}
|
|
4231
|
+
async function cleanupSandbox(runtime, state, keepDisk) {
|
|
3776
4232
|
const failures = [];
|
|
3777
4233
|
const relay = runtime.relays.get(state.buildId);
|
|
3778
4234
|
if (relay !== void 0) {
|
|
@@ -3782,6 +4238,13 @@ async function cleanupSandbox(runtime, state) {
|
|
|
3782
4238
|
runtime.relayFatal.delete(state.buildId);
|
|
3783
4239
|
runtime.leases.get(state.buildId)?.close();
|
|
3784
4240
|
runtime.leases.delete(state.buildId);
|
|
4241
|
+
if (keepDisk !== void 0) {
|
|
4242
|
+
try {
|
|
4243
|
+
await keepSandboxDisk(runtime, state, keepDisk);
|
|
4244
|
+
} catch (err) {
|
|
4245
|
+
keepDisk.warn(`the build's disk was not kept: ${err instanceof SandboxError ? describeSandboxError(err) : describeCallFailure(err)}`);
|
|
4246
|
+
}
|
|
4247
|
+
}
|
|
3785
4248
|
if (state.sandboxId !== "") {
|
|
3786
4249
|
try {
|
|
3787
4250
|
await client(runtime).end(state.sandboxId);
|
|
@@ -3800,6 +4263,13 @@ async function cleanupSandbox(runtime, state) {
|
|
|
3800
4263
|
if (failures.length > 0) throw new Error(failures.join("; "));
|
|
3801
4264
|
}
|
|
3802
4265
|
async function provisionSandbox(input) {
|
|
4266
|
+
const tag = itemTag({ item: input.item.number, organizationId: input.organizationId, claimId: input.claimId });
|
|
4267
|
+
return provisionWithFreshFallback({
|
|
4268
|
+
attempt: (_allowRestore, itemDiskFailed) => provisionSandboxOnce(input, itemDiskFailed),
|
|
4269
|
+
log: (line2) => input.log.line(`${tag} ${line2}`)
|
|
4270
|
+
});
|
|
4271
|
+
}
|
|
4272
|
+
async function provisionSandboxOnce(input, itemDiskFailed) {
|
|
3803
4273
|
const { config, runtime, item, itemKey, jobDir, log, tokens } = input;
|
|
3804
4274
|
const tag = itemTag({ item: item.number, organizationId: input.organizationId, claimId: input.claimId });
|
|
3805
4275
|
const logPath = join(jobDir, "provision.log");
|
|
@@ -3834,16 +4304,21 @@ async function provisionSandbox(input) {
|
|
|
3834
4304
|
});
|
|
3835
4305
|
if (unfetched !== void 0) return fail(unfetched);
|
|
3836
4306
|
}
|
|
4307
|
+
const diskKey = { imageId: diskImageOf(own), diskBytes: sized.size.diskGib * GIB2 };
|
|
4308
|
+
const itemDisk = input.workItemId === void 0 ? { state: void 0 } : itemDiskFailed !== void 0 ? { state: { restored: false, reason: itemDiskFailed } } : itemDiskDecision({ fresh: input.fresh, heldElsewhere: input.diskHeldElsewhere, builtin: true, backend: "sandbox", configPath: config.configPath, organizationId: input.organizationId, workItemId: input.workItemId, repository, ...diskKey });
|
|
4309
|
+
const keptDisk = itemDisk.kept;
|
|
4310
|
+
if (itemDisk.state?.restored === false) log.line(`${tag} this job starts without a kept disk: ${DISK_REASON_TEXT[itemDisk.state.reason]}`);
|
|
3837
4311
|
const buildId = randomBytes(6).toString("hex");
|
|
3838
4312
|
const runnerId = runnerLabelValue(config.configPath);
|
|
3839
4313
|
const name = sandboxNameOf(runnerId, buildId);
|
|
3840
4314
|
const container = `outerlayer-build-${buildId}`;
|
|
4315
|
+
const volumeName = keptDisk?.record.volume ?? container;
|
|
3841
4316
|
const buildDir2 = buildDir(config.configPath, buildId);
|
|
3842
4317
|
const image = own.image;
|
|
3843
4318
|
const containerState = {
|
|
3844
4319
|
buildId,
|
|
3845
4320
|
container,
|
|
3846
|
-
volume:
|
|
4321
|
+
volume: volumeName,
|
|
3847
4322
|
buildDir: buildDir2,
|
|
3848
4323
|
repository,
|
|
3849
4324
|
imageId: image,
|
|
@@ -3852,7 +4327,7 @@ async function provisionSandbox(input) {
|
|
|
3852
4327
|
transport: "exec",
|
|
3853
4328
|
jobFiles: "copied"
|
|
3854
4329
|
};
|
|
3855
|
-
const state = { sandboxId: "", name, dataPlaneUrl: "", buildId, container: containerState };
|
|
4330
|
+
const state = { sandboxId: "", name, dataPlaneUrl: "", buildId, diskKey, container: containerState };
|
|
3856
4331
|
const secrets = secretsOf(runtime, jobDir);
|
|
3857
4332
|
const env = buildEnvironment({
|
|
3858
4333
|
config,
|
|
@@ -3884,6 +4359,10 @@ async function provisionSandbox(input) {
|
|
|
3884
4359
|
}
|
|
3885
4360
|
return aborted2 ? { ok: false, reason: "ended before provision finished", aborted: true } : fail(reason);
|
|
3886
4361
|
};
|
|
4362
|
+
const giveUpItemDisk = async (reason, why) => {
|
|
4363
|
+
await bail(reason);
|
|
4364
|
+
return discardUnusableItemDisk({ kept: keptDisk, reason, why, removeVolume: async () => void 0, removeSnapshot: (snapshot) => sandboxClient.removeSnapshot(snapshot), onError: (line2) => log.error(`${tag} ${line2}`) });
|
|
4365
|
+
};
|
|
3887
4366
|
if (input.aborted()) return bail("", true);
|
|
3888
4367
|
mkdirSync(buildDir2, { recursive: true });
|
|
3889
4368
|
const ghDir = ghConfigDir(buildDir2);
|
|
@@ -3919,7 +4398,7 @@ async function provisionSandbox(input) {
|
|
|
3919
4398
|
try {
|
|
3920
4399
|
sandbox = await sandboxClient.create({
|
|
3921
4400
|
name,
|
|
3922
|
-
from: own.snapshot,
|
|
4401
|
+
from: keptDisk?.record.snapshot ?? own.snapshot,
|
|
3923
4402
|
...sized.size,
|
|
3924
4403
|
idleMinutes: own.idleMinutes,
|
|
3925
4404
|
timeLimitMinutes: sandboxTimeLimitMinutes(config.timeLimitMinutes),
|
|
@@ -3929,7 +4408,9 @@ async function provisionSandbox(input) {
|
|
|
3929
4408
|
} catch (err) {
|
|
3930
4409
|
if (err instanceof SandboxError && err.status === 0) await endUnansweredSandbox(sandboxClient, runnerId, buildId, (line2) => log.error(`${tag} ${line2}`));
|
|
3931
4410
|
runtime.sandbox.creating.delete(buildId);
|
|
3932
|
-
|
|
4411
|
+
const refused2 = `The provider refused to create the sandbox: ${err instanceof SandboxError ? describeSandboxError(err) : describeCallFailure(err)}`;
|
|
4412
|
+
if (keptDisk !== void 0 && err instanceof SandboxError && err.status === 404) return giveUpItemDisk(refused2, "disk_not_restored");
|
|
4413
|
+
return bail(refused2);
|
|
3933
4414
|
}
|
|
3934
4415
|
runtime.sandbox.sandboxes.set(buildId, sandbox);
|
|
3935
4416
|
state.sandboxId = sandbox.id;
|
|
@@ -3937,15 +4418,23 @@ async function provisionSandbox(input) {
|
|
|
3937
4418
|
input.save(state, environment);
|
|
3938
4419
|
runtime.sandbox.creating.delete(buildId);
|
|
3939
4420
|
log.line(`${tag} sandbox ${sandbox.id} created \xB7 ${name}`);
|
|
4421
|
+
if (keptDisk !== void 0) log.line(`${tag} restored the disk that claim ${shortClaim(keptDisk.record.claimId)} kept: snapshot ${keptDisk.record.snapshot}`);
|
|
3940
4422
|
if (input.aborted()) return bail("", true);
|
|
3941
4423
|
const sandboxed = runtimeInSandbox(runtime, sandbox);
|
|
3942
4424
|
const { host } = sandboxed;
|
|
3943
4425
|
const dockerFailed = (what, result) => bail(`${what} failed (exit ${result.status})${said(result.stderr)}`);
|
|
3944
4426
|
const joinSecret = randomBytes(32);
|
|
3945
4427
|
runtime.sandbox.joinSecrets.set(buildId, joinSecret);
|
|
4428
|
+
const packDir = join(runtime.cliBuild().distDir, "..", "skill-pack");
|
|
4429
|
+
const skillPack = existsSync(packDir) ? packDir : void 0;
|
|
3946
4430
|
try {
|
|
3947
4431
|
await sandboxClient.command(sandbox, `mkdir -p ${CLI_DIR}`);
|
|
3948
4432
|
await sandboxClient.upload(sandbox, `${SANDBOX_DIR}/dist.tgz`, gzipSync(packFolder(runtime.cliBuild().distDir)));
|
|
4433
|
+
if (skillPack !== void 0) {
|
|
4434
|
+
await sandboxClient.upload(sandbox, `${SANDBOX_DIR}/skill-pack.tgz`, gzipSync(packFolder(skillPack)));
|
|
4435
|
+
const placed = await sandboxClient.command(sandbox, `mkdir -p ${SKILL_PACK_DIR} && tar xzf ${SANDBOX_DIR}/skill-pack.tgz -C ${SKILL_PACK_DIR} && rm -f ${SANDBOX_DIR}/skill-pack.tgz`);
|
|
4436
|
+
if (placed.exitCode !== 0) return bail(`putting the skill pack in the sandbox failed (exit ${placed.exitCode ?? "none"})${said(placed.stderr)}`);
|
|
4437
|
+
}
|
|
3949
4438
|
await sandboxClient.upload(sandbox, SECRET_FILE, joinSecret);
|
|
3950
4439
|
const unpacked = await sandboxClient.command(sandbox, `tar xzf ${SANDBOX_DIR}/dist.tgz -C ${CLI_DIR} && rm -f ${SANDBOX_DIR}/dist.tgz && sudo chown 60100:60100 ${SECRET_FILE} && sudo chmod 400 ${SECRET_FILE}`);
|
|
3951
4440
|
if (unpacked.exitCode !== 0) return bail(`putting the CLI in the sandbox failed (exit ${unpacked.exitCode ?? "none"})${said(unpacked.stderr)}`);
|
|
@@ -3955,13 +4444,13 @@ async function provisionSandbox(input) {
|
|
|
3955
4444
|
const engine = await host.version();
|
|
3956
4445
|
if (engine === null) return bail("Docker is not available in the sandbox: `docker version` failed");
|
|
3957
4446
|
const limits2 = { memory: `${Math.max(512, sized.size.memoryMib - SANDBOX_RESERVE_MIB)}m`, cpus: sized.size.vcpu, pids: config.build?.pids ?? 4096 };
|
|
3958
|
-
const volume = await host.createVolume(
|
|
4447
|
+
const volume = await host.createVolume(volumeName, { [BUILD_LABEL]: buildId, [RUNNER_LABEL]: runnerId });
|
|
3959
4448
|
if (volume.status !== 0) return dockerFailed("creating the build's volume", volume);
|
|
3960
4449
|
const runInput = {
|
|
3961
4450
|
buildId,
|
|
3962
4451
|
runnerId,
|
|
3963
4452
|
container,
|
|
3964
|
-
volume:
|
|
4453
|
+
volume: volumeName,
|
|
3965
4454
|
image,
|
|
3966
4455
|
user: ADDED_USER,
|
|
3967
4456
|
limits: limits2,
|
|
@@ -3980,24 +4469,9 @@ async function provisionSandbox(input) {
|
|
|
3980
4469
|
const agentUser = resolved.user;
|
|
3981
4470
|
input.save(state, environment);
|
|
3982
4471
|
if (input.aborted()) return bail("", true);
|
|
3983
|
-
const started = await host.run(sandboxRunArgs(containerRunArgs({ ...runInput, home: containerState.home }, runtime.agents)), { logPath });
|
|
4472
|
+
const started = await host.run(sandboxRunArgs(containerRunArgs({ ...runInput, home: containerState.home }, runtime.agents), { skillPack: skillPack !== void 0 }), { logPath });
|
|
3984
4473
|
if (started.status !== 0) return dockerFailed("starting the build's container", started);
|
|
3985
|
-
|
|
3986
|
-
url: () => sandboxClient.portUrl(sandbox, JOIN_WS_PORT),
|
|
3987
|
-
secret: joinSecret,
|
|
3988
|
-
...runtime.sandbox.webSocket === void 0 ? {} : { webSocket: runtime.sandbox.webSocket }
|
|
3989
|
-
});
|
|
3990
|
-
runtime.relays.set(
|
|
3991
|
-
buildId,
|
|
3992
|
-
superviseRelay({
|
|
3993
|
-
container,
|
|
3994
|
-
services: services.streams,
|
|
3995
|
-
execStream: () => exec(),
|
|
3996
|
-
log: (line2) => log.line(`${tag} ${line2}`),
|
|
3997
|
-
onFatal: (reason) => runtime.relayFatal.set(buildId, reason),
|
|
3998
|
-
builtIns: builtInNames(runtime.agents)
|
|
3999
|
-
})
|
|
4000
|
-
);
|
|
4474
|
+
joinRelay(runtime, sandbox, { buildId, container }, services.streams, joinSecret, (line2) => log.line(`${tag} ${line2}`));
|
|
4001
4475
|
if (input.aborted()) return bail("", true);
|
|
4002
4476
|
if (!await waitForRelay(sandboxed, container)) return bail("the relay in the build's container did not start");
|
|
4003
4477
|
const ghDelivered = await deliverJobFiles(sandboxed, containerState, ["gh"], secrets);
|
|
@@ -4012,6 +4486,8 @@ async function provisionSandbox(input) {
|
|
|
4012
4486
|
const tools = await host.exec({ container, user: ADDED_USER, env: NO_ENV, argv: ["cat", "/opt/outerlayer/tools.json"] });
|
|
4013
4487
|
const agentVersion = agentVersionOf(tools.status === 0 ? tools.stdout : "", runtime.agents, input.job);
|
|
4014
4488
|
environment.agentVersion = agentVersion;
|
|
4489
|
+
const judgeProgram = await judgeProgramRecord((argv) => host.exec({ container, user: ADDED_USER, env: NO_ENV, argv }), runtime.agents);
|
|
4490
|
+
if (judgeProgram !== void 0) containerState.judgeProgram = judgeProgram;
|
|
4015
4491
|
input.save(state, environment);
|
|
4016
4492
|
const stepExec = async (argv, workdir, opts) => {
|
|
4017
4493
|
const ran = await host.exec({ container, user: agentUser, workdir, env: withMiseVariables(env, opts?.variables), argv }, { ...opts?.quiet === true ? {} : { logPath }, ...opts?.timeoutMs === void 0 ? {} : { timeoutMs: opts.timeoutMs } });
|
|
@@ -4046,467 +4522,225 @@ async function provisionSandbox(input) {
|
|
|
4046
4522
|
deliverContext: async () => {
|
|
4047
4523
|
const delivered = await deliverJobFiles(sandboxed, containerState, ["context"], secrets);
|
|
4048
4524
|
return delivered.ok ? delivered : { ok: false, reason: `context_unavailable: ${delivered.reason}` };
|
|
4049
|
-
},
|
|
4050
|
-
removeStagedContext: () => removeStagedContext(buildDir2),
|
|
4051
|
-
keepIn: jobDir,
|
|
4052
|
-
...input.requireBuildSkill === true ? { requireBuildSkill: true } : {},
|
|
4053
|
-
// The image in the snapshot is the universal image, so the build chooses and installs its runtimes.
|
|
4054
|
-
...runtimeStepInput({ base: {} }, services),
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
if (!steps.ok) return steps.aborted === true ? bail("", true) : bail(steps.reason);
|
|
4058
|
-
containerState.startCommit = steps.startCommit;
|
|
4059
|
-
keepRuntimeStep(containerState, steps);
|
|
4060
|
-
keepMissingSetupScripts(containerState, steps);
|
|
4061
|
-
if (steps.controlPlane !== void 0) environment.controlPlane = steps.controlPlane;
|
|
4062
|
-
input.save(state, environment);
|
|
4063
|
-
return { ok: true, workdir: CHECKOUT_DIR, state, environment };
|
|
4064
|
-
}
|
|
4065
|
-
function asContainerJob(job) {
|
|
4066
|
-
return { ...job, container: job.sandbox.container };
|
|
4067
|
-
}
|
|
4068
|
-
async function deliverSandboxHooks(runtime, state, jobDir) {
|
|
4069
|
-
try {
|
|
4070
|
-
return await deliverJobFiles(await inSandbox(runtime, state), state.container, ["git-hooks"], secretsOf(runtime, jobDir));
|
|
4071
|
-
} catch (err) {
|
|
4072
|
-
return { ok: false, reason: `the commit hooks could not be delivered: ${describeCallFailure(err)}` };
|
|
4073
|
-
}
|
|
4074
|
-
}
|
|
4075
|
-
async function startSandboxCommand(input) {
|
|
4076
|
-
const own = input.job.sandbox;
|
|
4077
|
-
const runtime = await inSandbox(input.runtime, own);
|
|
4078
|
-
const exec = containerCommandExec({ job: asContainerJob(input.job), cmdline: input.cmdline, runtime, config: input.config, ...input.extraEnv === void 0 ? {} : { extraEnv: input.extraEnv } });
|
|
4079
|
-
const started = await runtime.host.execDetached(exec);
|
|
4080
|
-
if (started.status !== 0) {
|
|
4081
|
-
const first = started.stderr.trim().split("\n")[0] ?? "";
|
|
4082
|
-
throw new Error(`docker exec exited ${started.status}${first === "" ? "" : `: ${first}`}`);
|
|
4083
|
-
}
|
|
4084
|
-
}
|
|
4085
|
-
async function probeSandboxCommand(runtime, state, offset) {
|
|
4086
|
-
let sandboxed;
|
|
4087
|
-
try {
|
|
4088
|
-
sandboxed = await inSandbox(runtime, state);
|
|
4089
|
-
} catch (err) {
|
|
4090
|
-
if (err instanceof SandboxGoneError) throw await goneReason(runtime, state) ?? err;
|
|
4091
|
-
return void 0;
|
|
4092
|
-
}
|
|
4093
|
-
try {
|
|
4094
|
-
const result = await sandboxed.host.exec(
|
|
4095
|
-
{ container: state.container.container, user: state.container.agentUser ?? ADDED_USER, env: NO_ENV, argv: probeArgvOf(offset) },
|
|
4096
|
-
{ timeoutMs: 6e4 }
|
|
4097
|
-
);
|
|
4098
|
-
return result.status === 0 ? parseProbe(result.stdout) : void 0;
|
|
4099
|
-
} catch (err) {
|
|
4100
|
-
if (err instanceof SandboxError && err.status === 404) throw await goneReason(runtime, state) ?? new SandboxGoneError(state.sandboxId);
|
|
4101
|
-
if (err instanceof SandboxError) return void 0;
|
|
4102
|
-
throw err;
|
|
4103
|
-
}
|
|
4104
|
-
}
|
|
4105
|
-
function probeArgvOf(offset) {
|
|
4106
|
-
const argv = probeArgv(offset);
|
|
4107
|
-
argv[argv.length - 1] = String(SANDBOX_PROBE_BYTES);
|
|
4108
|
-
return argv;
|
|
4109
|
-
}
|
|
4110
|
-
async function endSandboxCommand(runtime, state, jobDir, warn) {
|
|
4111
|
-
try {
|
|
4112
|
-
const sandboxed = await inSandbox(runtime, state);
|
|
4113
|
-
for (let reads = 0; reads < MAX_TAIL_READS2; reads++) {
|
|
4114
|
-
const offset = commandLogOffset(jobDir, state.commandLogBase);
|
|
4115
|
-
const probe = await probeSandboxCommand(runtime, state, offset);
|
|
4116
|
-
if (probe === void 0) break;
|
|
4117
|
-
appendCommandLog(jobDir, probe.bytes);
|
|
4118
|
-
if (probe.bytes.length === 0 || offset + probe.bytes.length >= probe.size) break;
|
|
4119
|
-
}
|
|
4120
|
-
await sandboxed.host.stop(state.container.container);
|
|
4121
|
-
} catch (err) {
|
|
4122
|
-
warn(`ending the build's command in its sandbox failed: ${describeCallFailure(err)} \xB7 continuing`);
|
|
4123
|
-
}
|
|
4124
|
-
}
|
|
4125
|
-
async function runCliInSandbox(input, argv, logName) {
|
|
4126
|
-
const { job } = input;
|
|
4127
|
-
const own = job.sandbox;
|
|
4128
|
-
try {
|
|
4129
|
-
const sandboxed = await inSandbox(input.runtime, own);
|
|
4130
|
-
const state = own.container;
|
|
4131
|
-
const env = buildEnvironment({
|
|
4132
|
-
config: claimCalls(input.config, job),
|
|
4133
|
-
item: job.item,
|
|
4134
|
-
...job.queue === "run" ? { run: true } : {},
|
|
4135
|
-
itemKey: job.itemKey,
|
|
4136
|
-
branch: job.branch,
|
|
4137
|
-
repository: state.repository,
|
|
4138
|
-
repositories: job.repositories,
|
|
4139
|
-
hostEnv: input.runtime.hostEnv,
|
|
4140
|
-
agents: input.runtime.agents,
|
|
4141
|
-
job,
|
|
4142
|
-
containerEnv: state.containerEnv ?? {},
|
|
4143
|
-
unpinnedRuntimes: state.unpinnedRuntimes,
|
|
4144
|
-
missingSetupScripts: state.missingSetupScripts,
|
|
4145
|
-
miseVariables: state.miseVariables,
|
|
4146
|
-
builtIns: true,
|
|
4147
|
-
identity: job.commitIdentity
|
|
4148
|
-
});
|
|
4149
|
-
const result = await sandboxed.host.exec(
|
|
4150
|
-
{ container: state.container, user: state.agentUser ?? ADDED_USER, workdir: job.workdir ?? CHECKOUT_DIR, env, argv },
|
|
4151
|
-
{ logPath: join(input.jobDir, logName) }
|
|
4152
|
-
);
|
|
4153
|
-
return result.status === 0 ? { ok: true } : { ok: false, reason: `exit ${result.status}` };
|
|
4154
|
-
} catch (err) {
|
|
4155
|
-
return { ok: false, reason: describeCallFailure(err) };
|
|
4156
|
-
}
|
|
4157
|
-
}
|
|
4158
|
-
function syncInSandbox(input) {
|
|
4159
|
-
return runCliInSandbox(input, ["outerlayer", "sync"], "sync.log");
|
|
4160
|
-
}
|
|
4161
|
-
function recordProofsInSandbox(input) {
|
|
4162
|
-
return runCliInSandbox(input, [...RECORD_PROOFS_ARGV], PROOFS_LOG);
|
|
4163
|
-
}
|
|
4164
|
-
function savedStatesDir(runnerDirPath) {
|
|
4165
|
-
return join(runnerDirPath, "saved-states");
|
|
4166
|
-
}
|
|
4167
|
-
function writeRecord2(dir, record) {
|
|
4168
|
-
mkdirSync(dir, { recursive: true, mode: RUNNER_DIR_MODE });
|
|
4169
|
-
const target2 = join(dir, `${record.id}.json`);
|
|
4170
|
-
const partial = `${target2}.partial`;
|
|
4171
|
-
writeFileSync(partial, `${JSON.stringify(record, null, 2)}
|
|
4172
|
-
`, { mode: RUNNER_FILE_MODE });
|
|
4173
|
-
renameSync(partial, target2);
|
|
4174
|
-
}
|
|
4175
|
-
function isRecord(value) {
|
|
4176
|
-
if (typeof value !== "object" || value === null) return false;
|
|
4177
|
-
const r = value;
|
|
4178
|
-
return typeof r.id === "string" && (r.kind === "volume" || r.kind === "tar" || r.kind === "disk") && typeof r.savedAt === "string" && Number.isFinite(Date.parse(r.savedAt)) && typeof r.bytes === "number" && typeof r.baseKey === "string" && typeof r.key === "string" && typeof r.fileHashes === "object" && r.fileHashes !== null && typeof r.complete === "boolean";
|
|
4179
|
-
}
|
|
4180
|
-
function readRecords(dir) {
|
|
4181
|
-
let names;
|
|
4182
|
-
try {
|
|
4183
|
-
names = readdirSync(dir);
|
|
4184
|
-
} catch {
|
|
4185
|
-
return [];
|
|
4186
|
-
}
|
|
4187
|
-
const records = [];
|
|
4188
|
-
for (const name of names) {
|
|
4189
|
-
if (!name.endsWith(".json")) continue;
|
|
4190
|
-
try {
|
|
4191
|
-
const parsed = JSON.parse(readFileSync(join(dir, name), "utf8"));
|
|
4192
|
-
if (isRecord(parsed)) records.push(parsed);
|
|
4193
|
-
} catch {
|
|
4194
|
-
}
|
|
4195
|
-
}
|
|
4196
|
-
return records;
|
|
4197
|
-
}
|
|
4198
|
-
function deleteRecord(dir, id) {
|
|
4199
|
-
rmSync(join(dir, `${id}.json`), { force: true });
|
|
4200
|
-
}
|
|
4201
|
-
|
|
4202
|
-
// src/runner/saved-state/remove.ts
|
|
4203
|
-
async function removeSavedState(record, deps) {
|
|
4204
|
-
if (record.kind === "volume" && record.volume !== void 0) {
|
|
4205
|
-
const result = await deps.removeVolume(record.volume);
|
|
4206
|
-
if (result !== void 0 && result.status !== 0) {
|
|
4207
|
-
const line2 = (result.stderr ?? "").trim().split("\n").filter((text2) => text2.trim() !== "").at(-1);
|
|
4208
|
-
throw new Error(`Docker could not remove volume ${record.volume} (exit ${result.status}${line2 === void 0 ? "" : `: ${line2}`})`);
|
|
4209
|
-
}
|
|
4210
|
-
}
|
|
4211
|
-
if ((record.kind === "tar" || record.kind === "disk") && record.path !== void 0) {
|
|
4212
|
-
rmSync(`${record.path}.partial`, { force: true });
|
|
4213
|
-
rmSync(record.path, { force: true });
|
|
4214
|
-
}
|
|
4215
|
-
deleteRecord(deps.dir, record.id);
|
|
4216
|
-
}
|
|
4217
|
-
async function removeOldestUntil(input) {
|
|
4218
|
-
const removed = [];
|
|
4219
|
-
for (const record of oldestFirst(input.records)) {
|
|
4220
|
-
if (input.enough()) break;
|
|
4221
|
-
try {
|
|
4222
|
-
await removeSavedState(record, input.deps);
|
|
4223
|
-
removed.push(record);
|
|
4224
|
-
input.log(`removed saved state ${record.id} from ${record.savedAt}`);
|
|
4225
|
-
} catch (err) {
|
|
4226
|
-
input.log(`could not remove saved state ${record.id}: ${describeCallFailure(err)}`);
|
|
4227
|
-
}
|
|
4228
|
-
}
|
|
4229
|
-
return removed;
|
|
4230
|
-
}
|
|
4231
|
-
async function removeSuperseded(input) {
|
|
4232
|
-
for (const old of input.records.filter((record) => record.complete && record.key === input.made.key && record.id !== input.made.id && Date.parse(record.savedAt) < Date.parse(input.made.savedAt))) {
|
|
4233
|
-
try {
|
|
4234
|
-
await removeSavedState(old, input.deps);
|
|
4235
|
-
input.log(`removed saved state ${old.id}, saved state ${input.made.id} replaces it`);
|
|
4236
|
-
} catch (err) {
|
|
4237
|
-
input.log(`could not remove saved state ${old.id}: ${describeCallFailure(err)}`);
|
|
4238
|
-
}
|
|
4239
|
-
}
|
|
4240
|
-
}
|
|
4241
|
-
|
|
4242
|
-
// src/runner/saved-state/plan.ts
|
|
4243
|
-
function savedStateBase(report) {
|
|
4244
|
-
const digest = report.recipe === "default" ? report.base?.digest : void 0;
|
|
4245
|
-
return digest === void 0 ? void 0 : { digest };
|
|
4246
|
-
}
|
|
4247
|
-
function savedStateMaxOf(config) {
|
|
4248
|
-
return config.housekeeping?.savedStateMax ?? DEFAULT_SAVED_STATE_MAX_BYTES;
|
|
4249
|
-
}
|
|
4250
|
-
async function planSavedState(input) {
|
|
4251
|
-
const { config, runtime, log } = input;
|
|
4252
|
-
const refused2 = savingRefusedBecause({ universalImage: input.base !== void 0, fleet: config.fleet === true, savedStateMax: savedStateMaxOf(config) });
|
|
4253
|
-
if (refused2 !== void 0 || input.base === void 0) {
|
|
4254
|
-
const why = refused2 ?? "its image comes from a devcontainer file";
|
|
4255
|
-
log(`this build saves no state: ${why}`);
|
|
4256
|
-
return { keyCommits: {}, noSave: why };
|
|
4257
|
-
}
|
|
4258
|
-
const root = runnerDir(config.configPath);
|
|
4259
|
-
const repositories = [];
|
|
4260
|
-
const keyCommits = {};
|
|
4261
|
-
for (const entry of input.repositories) {
|
|
4262
|
-
let token;
|
|
4263
|
-
try {
|
|
4264
|
-
token = entry.primary ? await input.tokens.token("read") : await input.tokens.token("read", entry.repository);
|
|
4265
|
-
} catch (err) {
|
|
4266
|
-
return unread(`the read token for ${entry.repository} could not be had: ${describeCallFailure(err)}`, log);
|
|
4267
|
-
}
|
|
4268
|
-
const [owner = "", name = ""] = entry.repository.split("/");
|
|
4269
|
-
const read = await runtime.readKeyFiles({
|
|
4270
|
-
remote: runtime.remoteFor?.(entry.repository) ?? `${runtime.github.gitUrl}/${entry.repository}.git`,
|
|
4271
|
-
dir: join(root, "key-files", owner, name),
|
|
4272
|
-
paths: keyFilePaths(),
|
|
4273
|
-
token
|
|
4274
|
-
});
|
|
4275
|
-
if (!read.ok) return unread(read.reason, log);
|
|
4276
|
-
keyCommits[entry.repository] = read.commit;
|
|
4277
|
-
repositories.push({ repository: entry.repository, commit: read.commit, files: read.files });
|
|
4278
|
-
}
|
|
4279
|
-
const key = stateKey({
|
|
4280
|
-
factory: keyRunnerFactory(config),
|
|
4281
|
-
repositories,
|
|
4282
|
-
imageDigest: input.base.digest,
|
|
4283
|
-
diskBytes: input.diskBytes
|
|
4525
|
+
},
|
|
4526
|
+
removeStagedContext: () => removeStagedContext(buildDir2),
|
|
4527
|
+
keepIn: jobDir,
|
|
4528
|
+
...input.requireBuildSkill === true ? { requireBuildSkill: true } : {},
|
|
4529
|
+
// The image in the snapshot is the universal image, so the build chooses and installs its runtimes.
|
|
4530
|
+
...runtimeStepInput({ base: {} }, services),
|
|
4531
|
+
// A kept disk holds the checkouts already: each is switched to the branch, and keeps its untracked files.
|
|
4532
|
+
setup: { timeoutMs: setupMinutes * 6e4, limitMinutes: setupMinutes, restored: false, ...keptDisk === void 0 ? {} : { restored: true, fromItemDisk: true } }
|
|
4284
4533
|
});
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
}
|
|
4293
|
-
return { key, keyCommits };
|
|
4294
|
-
}
|
|
4295
|
-
if (found.kind === "usable" && input.allowRestore) {
|
|
4296
|
-
log(`starting from saved state ${found.record.id}, saved ${formatDuration(found.ageMs)} ago`);
|
|
4297
|
-
return { key, keyCommits, restore: { record: found.record, ageMs: found.ageMs } };
|
|
4298
|
-
}
|
|
4299
|
-
if (found.kind === "expired") {
|
|
4300
|
-
log(`saved state ${found.record.id} is ${formatDuration(found.ageMs)} old, past the limit of ${SAVED_STATE_MAX_AGE_MS / 864e5} days; starting from a fresh disk`);
|
|
4301
|
-
} else if (found.kind === "changed") {
|
|
4302
|
-
log(`the setup script or version files changed on the default branch since saved state ${found.record.id}: ${found.files.join(", ")}; starting from a fresh disk`);
|
|
4303
|
-
} else if (found.kind === "none") {
|
|
4304
|
-
log("no saved state matches this build's key; starting from a fresh disk");
|
|
4305
|
-
}
|
|
4306
|
-
return { key, keyCommits };
|
|
4307
|
-
}
|
|
4308
|
-
function unread(reason, log) {
|
|
4309
|
-
log(`this build starts from no saved state and saves none: ${reason}`);
|
|
4310
|
-
return { keyCommits: {}, noSave: `its key files could not be read: ${reason}` };
|
|
4534
|
+
if (!steps.ok) return settleFailedSteps(steps, { giveUp: (reason) => giveUpItemDisk(reason, "checkout_not_switched"), bail });
|
|
4535
|
+
containerState.startCommit = steps.startCommit;
|
|
4536
|
+
keepRuntimeStep(containerState, steps);
|
|
4537
|
+
keepMissingSetupScripts(containerState, steps);
|
|
4538
|
+
if (steps.controlPlane !== void 0) environment.controlPlane = steps.controlPlane;
|
|
4539
|
+
input.save(state, environment);
|
|
4540
|
+
return { ok: true, workdir: CHECKOUT_DIR, state, environment, ...itemDisk.state === void 0 ? {} : { disk: itemDisk.state } };
|
|
4311
4541
|
}
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
var WORK_ITEM_ID2 = /^[A-Za-z0-9_-]{1,64}$/;
|
|
4315
|
-
function itemDiskDir(configPath, organizationId, workItemId) {
|
|
4316
|
-
if (!WORK_ITEM_ID2.test(workItemId)) throw new Error(`cannot keep a disk for the work item ${JSON.stringify(workItemId)}`);
|
|
4317
|
-
return join(workspacesDir(configPath, organizationId), workItemId);
|
|
4542
|
+
function asContainerJob(job) {
|
|
4543
|
+
return { ...job, container: job.sandbox.container };
|
|
4318
4544
|
}
|
|
4319
|
-
function
|
|
4320
|
-
|
|
4321
|
-
const
|
|
4322
|
-
|
|
4545
|
+
function sandboxJudgeEnvironment(input) {
|
|
4546
|
+
const own = input.job.sandbox;
|
|
4547
|
+
const state = own.container;
|
|
4548
|
+
const inner = async () => containerJudgeEnvironment({ runtime: await inSandbox(input.runtime, own), job: asContainerJob(input.job), jobDir: input.jobDir, ...input.log === void 0 ? {} : { log: input.log } });
|
|
4549
|
+
return {
|
|
4550
|
+
stop: async () => {
|
|
4551
|
+
const { runtime } = input;
|
|
4552
|
+
const services = runtime.tunnels.get(state.buildId);
|
|
4553
|
+
const joinSecret = runtime.sandbox.joinSecrets.get(state.buildId);
|
|
4554
|
+
if (services?.streams === void 0 || joinSecret === void 0) throw new Error("the runner no longer holds the build's tunnel and join secret, so it cannot join the build's relay again");
|
|
4555
|
+
const sandbox = await sandboxOfBuild(runtime, own);
|
|
4556
|
+
if (sandbox === void 0) throw new SandboxGoneError(own.sandboxId);
|
|
4557
|
+
const sandboxed = runtimeInSandbox(runtime, sandbox);
|
|
4558
|
+
runtime.leases.get(state.buildId)?.stop();
|
|
4559
|
+
const relay = runtime.relays.get(state.buildId);
|
|
4560
|
+
if (relay !== void 0) {
|
|
4561
|
+
runtime.relays.delete(state.buildId);
|
|
4562
|
+
await relay.close();
|
|
4563
|
+
}
|
|
4564
|
+
await sandboxed.host.stop(state.container);
|
|
4565
|
+
const started = await sandboxed.host.start(state.container);
|
|
4566
|
+
if (started.status !== 0) throw new Error(`the build's container could not be started again (exit ${started.status})`);
|
|
4567
|
+
if (!await waitForRelay(sandboxed, state.container)) throw new Error("the relay in the build's container did not start again");
|
|
4568
|
+
joinRelay(runtime, sandbox, { buildId: state.buildId, container: state.container }, services.streams, joinSecret, input.log);
|
|
4569
|
+
const delivered = await deliverJobFiles(sandboxed, state, ["gh", "git-hooks", "context"], secretsOf(runtime, input.jobDir));
|
|
4570
|
+
if (!delivered.ok) throw new Error(delivered.reason);
|
|
4571
|
+
},
|
|
4572
|
+
hashProgram: async () => (await inner()).hashProgram(),
|
|
4573
|
+
prepare: async (files, tree) => (await inner()).prepare(files, tree),
|
|
4574
|
+
run: async (command, opts) => (await inner()).run(command, opts),
|
|
4575
|
+
readReport: async () => (await inner()).readReport(),
|
|
4576
|
+
readItems: async (name) => (await inner()).readItems(name),
|
|
4577
|
+
clear: async () => (await inner()).clear?.()
|
|
4578
|
+
};
|
|
4323
4579
|
}
|
|
4324
|
-
function
|
|
4325
|
-
let parsed;
|
|
4580
|
+
async function deliverSandboxHooks(runtime, state, jobDir) {
|
|
4326
4581
|
try {
|
|
4327
|
-
|
|
4328
|
-
} catch {
|
|
4329
|
-
return
|
|
4582
|
+
return await deliverJobFiles(await inSandbox(runtime, state), state.container, ["git-hooks"], secretsOf(runtime, jobDir));
|
|
4583
|
+
} catch (err) {
|
|
4584
|
+
return { ok: false, reason: `the commit hooks could not be delivered: ${describeCallFailure(err)}` };
|
|
4330
4585
|
}
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
const
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4586
|
+
}
|
|
4587
|
+
async function startSandboxCommand(input) {
|
|
4588
|
+
const own = input.job.sandbox;
|
|
4589
|
+
const runtime = await inSandbox(input.runtime, own);
|
|
4590
|
+
const exec = containerCommandExec({ job: asContainerJob(input.job), cmdline: input.cmdline, runtime, config: input.config, ...input.extraEnv === void 0 ? {} : { extraEnv: input.extraEnv } });
|
|
4591
|
+
const started = await runtime.host.execDetached(exec);
|
|
4592
|
+
if (started.status !== 0) {
|
|
4593
|
+
const first = started.stderr.trim().split("\n")[0] ?? "";
|
|
4594
|
+
throw new Error(`docker exec exited ${started.status}${first === "" ? "" : `: ${first}`}`);
|
|
4338
4595
|
}
|
|
4339
|
-
return { dir, record: parsed, path };
|
|
4340
4596
|
}
|
|
4341
|
-
function
|
|
4342
|
-
|
|
4343
|
-
const outgoing = join(dirname(dir), `.${basename(dir)}.${randomBytes(4).toString("hex")}.old`);
|
|
4344
|
-
let hadOlder = true;
|
|
4597
|
+
async function probeSandboxCommand(runtime, state, offset) {
|
|
4598
|
+
let sandboxed;
|
|
4345
4599
|
try {
|
|
4346
|
-
|
|
4600
|
+
sandboxed = await inSandbox(runtime, state);
|
|
4347
4601
|
} catch (err) {
|
|
4348
|
-
if (err
|
|
4349
|
-
|
|
4602
|
+
if (err instanceof SandboxGoneError) throw await goneReason(runtime, state) ?? err;
|
|
4603
|
+
return void 0;
|
|
4350
4604
|
}
|
|
4351
4605
|
try {
|
|
4352
|
-
|
|
4606
|
+
const result = await sandboxed.host.exec(
|
|
4607
|
+
{ container: state.container.container, user: state.container.agentUser ?? ADDED_USER, env: NO_ENV, argv: probeArgvOf(offset) },
|
|
4608
|
+
{ timeoutMs: 6e4 }
|
|
4609
|
+
);
|
|
4610
|
+
return result.status === 0 ? parseProbe(result.stdout) : void 0;
|
|
4353
4611
|
} catch (err) {
|
|
4354
|
-
if (
|
|
4612
|
+
if (err instanceof SandboxError && err.status === 404) throw await goneReason(runtime, state) ?? new SandboxGoneError(state.sandboxId);
|
|
4613
|
+
if (err instanceof SandboxError) return void 0;
|
|
4355
4614
|
throw err;
|
|
4356
4615
|
}
|
|
4357
|
-
rmSync(outgoing, { recursive: true, force: true });
|
|
4358
|
-
return older;
|
|
4359
4616
|
}
|
|
4360
|
-
function
|
|
4361
|
-
const
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
mkdirSync(staging, { mode: 448 });
|
|
4365
|
-
return staging;
|
|
4366
|
-
}
|
|
4367
|
-
function listItemDisks(configPath, scope) {
|
|
4368
|
-
const where = workspacesDir(configPath, scope);
|
|
4369
|
-
let names;
|
|
4370
|
-
try {
|
|
4371
|
-
names = readdirSync(where);
|
|
4372
|
-
} catch {
|
|
4373
|
-
return [];
|
|
4374
|
-
}
|
|
4375
|
-
const kept = [];
|
|
4376
|
-
for (const name of names) {
|
|
4377
|
-
if (!WORK_ITEM_ID2.test(name)) continue;
|
|
4378
|
-
const found = readItemDisk(join(where, name));
|
|
4379
|
-
if (found !== void 0) kept.push(found);
|
|
4380
|
-
}
|
|
4381
|
-
return kept;
|
|
4617
|
+
function probeArgvOf(offset) {
|
|
4618
|
+
const argv = probeArgv(offset);
|
|
4619
|
+
argv[argv.length - 1] = String(SANDBOX_PROBE_BYTES);
|
|
4620
|
+
return argv;
|
|
4382
4621
|
}
|
|
4383
|
-
function
|
|
4384
|
-
const where = workspacesDir(configPath, scope);
|
|
4385
|
-
let names;
|
|
4622
|
+
async function endSandboxCommand(runtime, state, jobDir, warn) {
|
|
4386
4623
|
try {
|
|
4387
|
-
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
try {
|
|
4395
|
-
found.push({ path: join(where, name), mtimeMs: lstatSync(join(where, name)).mtimeMs });
|
|
4396
|
-
} catch {
|
|
4624
|
+
const sandboxed = await inSandbox(runtime, state);
|
|
4625
|
+
for (let reads = 0; reads < MAX_TAIL_READS2; reads++) {
|
|
4626
|
+
const offset = commandLogOffset(jobDir, state.commandLogBase);
|
|
4627
|
+
const probe = await probeSandboxCommand(runtime, state, offset);
|
|
4628
|
+
if (probe === void 0) break;
|
|
4629
|
+
appendCommandLog(jobDir, probe.bytes);
|
|
4630
|
+
if (probe.bytes.length === 0 || offset + probe.bytes.length >= probe.size) break;
|
|
4397
4631
|
}
|
|
4632
|
+
await sandboxed.host.stop(state.container.container);
|
|
4633
|
+
} catch (err) {
|
|
4634
|
+
warn(`ending the build's command in its sandbox failed: ${describeCallFailure(err)} \xB7 continuing`);
|
|
4398
4635
|
}
|
|
4399
|
-
return found;
|
|
4400
|
-
}
|
|
4401
|
-
|
|
4402
|
-
// src/runner/workspace/restore.ts
|
|
4403
|
-
var DISK_REASON_TEXT = {
|
|
4404
|
-
no_kept_disk: "no disk is kept for the work item on this host",
|
|
4405
|
-
other_image: "the kept disk was made on another image",
|
|
4406
|
-
other_disk_size: "the kept disk was made with another runner.build.disk size",
|
|
4407
|
-
disk_not_restored: "the kept disk could not be copied",
|
|
4408
|
-
checkout_not_switched: "the kept checkout could not be switched to the branch",
|
|
4409
|
-
build_type_cannot_restore: "this build type cannot restore a disk",
|
|
4410
|
-
fresh_requested: "a member asked for a fresh disk",
|
|
4411
|
-
holder_busy: "the machine that holds its disk was busy"
|
|
4412
|
-
};
|
|
4413
|
-
function itemDiskDecision(input) {
|
|
4414
|
-
if (input.fresh === true) return { state: { restored: false, reason: "fresh_requested" } };
|
|
4415
|
-
if (!input.builtin) return { state: { restored: false, reason: "build_type_cannot_restore" } };
|
|
4416
|
-
let kept;
|
|
4417
|
-
try {
|
|
4418
|
-
kept = readItemDisk(itemDiskDir(input.configPath, input.organizationId, input.workItemId));
|
|
4419
|
-
} catch {
|
|
4420
|
-
kept = void 0;
|
|
4421
|
-
}
|
|
4422
|
-
if (kept === void 0) return { state: { restored: false, reason: input.heldElsewhere === true ? "holder_busy" : "no_kept_disk" } };
|
|
4423
|
-
if (kept.record.repository !== input.repository) return { state: { restored: false, reason: "no_kept_disk" } };
|
|
4424
|
-
if (kept.record.imageId !== input.imageId) return { state: { restored: false, reason: "other_image" } };
|
|
4425
|
-
if (kept.record.diskBytes !== input.diskBytes) return { state: { restored: false, reason: "other_disk_size" } };
|
|
4426
|
-
if (kept.record.kind !== input.backend) return { state: { restored: false, reason: "disk_not_restored" } };
|
|
4427
|
-
return { kept, state: { restored: true, fromClaimId: kept.record.claimId } };
|
|
4428
4636
|
}
|
|
4429
|
-
async function
|
|
4637
|
+
async function runCliInSandbox(input, argv, logName) {
|
|
4638
|
+
const { job } = input;
|
|
4639
|
+
const own = job.sandbox;
|
|
4430
4640
|
try {
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
}
|
|
4437
|
-
|
|
4438
|
-
|
|
4641
|
+
const sandboxed = await inSandbox(input.runtime, own);
|
|
4642
|
+
const state = own.container;
|
|
4643
|
+
const env = buildEnvironment({
|
|
4644
|
+
config: claimCalls(input.config, job),
|
|
4645
|
+
item: job.item,
|
|
4646
|
+
...job.queue === "run" ? { run: true } : {},
|
|
4647
|
+
itemKey: job.itemKey,
|
|
4648
|
+
branch: job.branch,
|
|
4649
|
+
repository: state.repository,
|
|
4650
|
+
repositories: job.repositories,
|
|
4651
|
+
hostEnv: input.runtime.hostEnv,
|
|
4652
|
+
agents: input.runtime.agents,
|
|
4653
|
+
job,
|
|
4654
|
+
containerEnv: state.containerEnv ?? {},
|
|
4655
|
+
unpinnedRuntimes: state.unpinnedRuntimes,
|
|
4656
|
+
missingSetupScripts: state.missingSetupScripts,
|
|
4657
|
+
miseVariables: state.miseVariables,
|
|
4658
|
+
builtIns: true,
|
|
4659
|
+
identity: job.commitIdentity
|
|
4660
|
+
});
|
|
4661
|
+
const result = await sandboxed.host.exec(
|
|
4662
|
+
{ container: state.container, user: state.agentUser ?? ADDED_USER, workdir: job.workdir ?? CHECKOUT_DIR, env, argv },
|
|
4663
|
+
{ logPath: join(input.jobDir, logName) }
|
|
4664
|
+
);
|
|
4665
|
+
return result.status === 0 ? { ok: true } : { ok: false, reason: `exit ${result.status}` };
|
|
4439
4666
|
} catch (err) {
|
|
4440
|
-
|
|
4667
|
+
return { ok: false, reason: describeCallFailure(err) };
|
|
4441
4668
|
}
|
|
4442
4669
|
}
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
var isRetryFresh = (value) => typeof value === "object" && value !== null && value.retryFresh === true;
|
|
4446
|
-
async function provisionWithFreshFallback(input) {
|
|
4447
|
-
const first = await input.attempt(true);
|
|
4448
|
-
if (!isRetryFresh(first)) return first;
|
|
4449
|
-
input.log(`${first.reason}; provisioning the build again from a fresh disk`);
|
|
4450
|
-
if (first.itemDisk === void 0) return await input.attempt(false);
|
|
4451
|
-
const second = await input.attempt(true, first.itemDisk);
|
|
4452
|
-
if (!isRetryFresh(second)) return second;
|
|
4453
|
-
input.log(`${second.reason}; provisioning the build again from a fresh disk`);
|
|
4454
|
-
return await input.attempt(false, first.itemDisk);
|
|
4455
|
-
}
|
|
4456
|
-
function keptDiskPlan() {
|
|
4457
|
-
return { keyCommits: {}, noSave: "it starts from the work item's kept disk" };
|
|
4458
|
-
}
|
|
4459
|
-
function clockOf(now) {
|
|
4460
|
-
return now ?? (() => /* @__PURE__ */ new Date());
|
|
4461
|
-
}
|
|
4462
|
-
function taggedLog(log, tag) {
|
|
4463
|
-
return (line2) => log.line(`${tag} ${line2}`);
|
|
4464
|
-
}
|
|
4465
|
-
function uidFromProbe(probe) {
|
|
4466
|
-
const uid = Number(probe.stdout);
|
|
4467
|
-
return probe.status === 0 && Number.isInteger(uid) ? uid : null;
|
|
4468
|
-
}
|
|
4469
|
-
function agentUidOf(probe) {
|
|
4470
|
-
return uidFromProbe(probe) ?? void 0;
|
|
4670
|
+
function syncInSandbox(input) {
|
|
4671
|
+
return runCliInSandbox(input, ["outerlayer", "sync"], "sync.log");
|
|
4471
4672
|
}
|
|
4472
|
-
function
|
|
4473
|
-
|
|
4474
|
-
return `the build user's id is ${agentUid ?? "unknown"} and it was ${savedUid} when the state was saved`;
|
|
4673
|
+
function recordProofsInSandbox(input) {
|
|
4674
|
+
return runCliInSandbox(input, [...RECORD_PROOFS_ARGV], PROOFS_LOG);
|
|
4475
4675
|
}
|
|
4476
|
-
function
|
|
4477
|
-
const
|
|
4478
|
-
return {
|
|
4479
|
-
timeoutMs: minutes * 6e4,
|
|
4480
|
-
limitMinutes: minutes,
|
|
4481
|
-
restored: input.plan.restore !== void 0 || input.fromItemDisk === true,
|
|
4482
|
-
...input.fromItemDisk === true ? { fromItemDisk: true } : {},
|
|
4483
|
-
keyCommits: input.plan.keyCommits,
|
|
4484
|
-
...input.withoutBuildVariables === true ? { withoutBuildVariables: true } : {},
|
|
4485
|
-
// A plan has a key exactly when the build may save a state. A build that starts from one is not asked to save.
|
|
4486
|
-
...input.plan.key === void 0 ? {} : { saveState: input.saveState }
|
|
4487
|
-
};
|
|
4676
|
+
function savedStateBase(report) {
|
|
4677
|
+
const digest = report.recipe === "default" ? report.base?.digest : void 0;
|
|
4678
|
+
return digest === void 0 ? void 0 : { digest };
|
|
4488
4679
|
}
|
|
4489
|
-
|
|
4490
|
-
|
|
4491
|
-
if (!made.ok) return made;
|
|
4492
|
-
input.log(`saved state ${made.record.id}`);
|
|
4493
|
-
await removeSuperseded({ made: made.record, records: readRecords(input.dir), deps: { dir: input.dir, removeVolume: input.removeVolume }, log: input.log });
|
|
4494
|
-
return { ok: true };
|
|
4680
|
+
function savedStateMaxOf(config) {
|
|
4681
|
+
return config.housekeeping?.savedStateMax ?? DEFAULT_SAVED_STATE_MAX_BYTES;
|
|
4495
4682
|
}
|
|
4496
|
-
async function
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4683
|
+
async function planSavedState(input) {
|
|
4684
|
+
const { config, runtime, log } = input;
|
|
4685
|
+
const refused2 = savingRefusedBecause({ universalImage: input.base !== void 0, fleet: config.fleet === true, savedStateMax: savedStateMaxOf(config) });
|
|
4686
|
+
if (refused2 !== void 0 || input.base === void 0) {
|
|
4687
|
+
const why = refused2 ?? "its image comes from a devcontainer file";
|
|
4688
|
+
log(`this build saves no state: ${why}`);
|
|
4689
|
+
return { keyCommits: {}, noSave: why };
|
|
4501
4690
|
}
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4691
|
+
const root = runnerDir(config.configPath);
|
|
4692
|
+
const repositories = [];
|
|
4693
|
+
const keyCommits = {};
|
|
4694
|
+
for (const entry of input.repositories) {
|
|
4695
|
+
let token;
|
|
4696
|
+
try {
|
|
4697
|
+
token = entry.primary ? await input.tokens.token("read") : await input.tokens.token("read", entry.repository);
|
|
4698
|
+
} catch (err) {
|
|
4699
|
+
return unread(`the read token for ${entry.repository} could not be had: ${describeCallFailure(err)}`, log);
|
|
4700
|
+
}
|
|
4701
|
+
const [owner = "", name = ""] = entry.repository.split("/");
|
|
4702
|
+
const read = await runtime.readKeyFiles({
|
|
4703
|
+
remote: runtime.remoteFor?.(entry.repository) ?? `${runtime.github.gitUrl}/${entry.repository}.git`,
|
|
4704
|
+
dir: join(root, "key-files", owner, name),
|
|
4705
|
+
paths: keyFilePaths(),
|
|
4706
|
+
token
|
|
4707
|
+
});
|
|
4708
|
+
if (!read.ok) return unread(read.reason, log);
|
|
4709
|
+
keyCommits[entry.repository] = read.commit;
|
|
4710
|
+
repositories.push({ repository: entry.repository, commit: read.commit, files: read.files });
|
|
4711
|
+
}
|
|
4712
|
+
const key = stateKey({
|
|
4713
|
+
factory: keyRunnerFactory(config),
|
|
4714
|
+
repositories,
|
|
4715
|
+
imageDigest: input.base.digest,
|
|
4716
|
+
diskBytes: input.diskBytes
|
|
4717
|
+
});
|
|
4718
|
+
const found = lookup(readRecords(savedStatesDir(root)), key, input.now.getTime());
|
|
4719
|
+
if (found.kind !== "none" && found.record.kind === "tar") {
|
|
4720
|
+
try {
|
|
4721
|
+
await removeSavedState(found.record, { dir: savedStatesDir(root), removeVolume: async () => void 0 });
|
|
4722
|
+
log(`saved state ${found.record.id} is a tar file, which this runner no longer restores; removed it; starting from a fresh disk`);
|
|
4723
|
+
} catch (err) {
|
|
4724
|
+
log(`saved state ${found.record.id} is a tar file, which this runner no longer restores, and it could not be removed: ${describeCallFailure(err)}; starting from a fresh disk`);
|
|
4725
|
+
}
|
|
4726
|
+
return { key, keyCommits };
|
|
4727
|
+
}
|
|
4728
|
+
if (found.kind === "usable" && input.allowRestore) {
|
|
4729
|
+
log(`starting from saved state ${found.record.id}, saved ${formatDuration(found.ageMs)} ago`);
|
|
4730
|
+
return { key, keyCommits, restore: { record: found.record, ageMs: found.ageMs } };
|
|
4731
|
+
}
|
|
4732
|
+
if (found.kind === "expired") {
|
|
4733
|
+
log(`saved state ${found.record.id} is ${formatDuration(found.ageMs)} old, past the limit of ${SAVED_STATE_MAX_AGE_MS / 864e5} days; starting from a fresh disk`);
|
|
4734
|
+
} else if (found.kind === "changed") {
|
|
4735
|
+
log(`the setup script or version files changed on the default branch since saved state ${found.record.id}: ${found.files.join(", ")}; starting from a fresh disk`);
|
|
4736
|
+
} else if (found.kind === "none") {
|
|
4737
|
+
log("no saved state matches this build's key; starting from a fresh disk");
|
|
4738
|
+
}
|
|
4739
|
+
return { key, keyCommits };
|
|
4506
4740
|
}
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
return {
|
|
4741
|
+
function unread(reason, log) {
|
|
4742
|
+
log(`this build starts from no saved state and saves none: ${reason}`);
|
|
4743
|
+
return { keyCommits: {}, noSave: `its key files could not be read: ${reason}` };
|
|
4510
4744
|
}
|
|
4511
4745
|
var FREEZE_DEADLINE_SECONDS = 12 * 60;
|
|
4512
4746
|
function freezeScript() {
|
|
@@ -4529,7 +4763,7 @@ function freezeScript() {
|
|
|
4529
4763
|
"exit 5"
|
|
4530
4764
|
].join("\n");
|
|
4531
4765
|
}
|
|
4532
|
-
var
|
|
4766
|
+
var failureText2 = (status, stderr) => {
|
|
4533
4767
|
const line2 = stderr.trim().split("\n").at(-1) ?? "";
|
|
4534
4768
|
return `exit ${status}${line2 === "" ? "" : `: ${line2}`}`;
|
|
4535
4769
|
};
|
|
@@ -4572,7 +4806,7 @@ async function freezeGuest(guest, deadlineSeconds = FREEZE_DEADLINE_SECONDS) {
|
|
|
4572
4806
|
const first = await Promise.race([frozen, ended]);
|
|
4573
4807
|
if (first !== "frozen") {
|
|
4574
4808
|
stdin.end();
|
|
4575
|
-
return { ok: false, reason: "error" in first ? `the guest could not freeze /build: ${first.error}` : `the guest could not freeze /build (${
|
|
4809
|
+
return { ok: false, reason: "error" in first ? `the guest could not freeze /build: ${first.error}` : `the guest could not freeze /build (${failureText2(first.status, stderr)})` };
|
|
4576
4810
|
}
|
|
4577
4811
|
return {
|
|
4578
4812
|
ok: true,
|
|
@@ -4583,8 +4817,8 @@ async function freezeGuest(guest, deadlineSeconds = FREEZE_DEADLINE_SECONDS) {
|
|
|
4583
4817
|
const result = await ended;
|
|
4584
4818
|
if ("error" in result) return { ok: false, reason: `the freeze command's connection failed: ${result.error}` };
|
|
4585
4819
|
if (thawedBeforeAsked) return { ok: false, reason: "the freeze command thawed /build before the runner asked" };
|
|
4586
|
-
if (!thawedAfterAsked) return { ok: false, reason: `the freeze command did not say it thawed /build (${
|
|
4587
|
-
if (result.status !== 0) return { ok: false, reason: `the freeze command ended badly after it thawed /build (${
|
|
4820
|
+
if (!thawedAfterAsked) return { ok: false, reason: `the freeze command did not say it thawed /build (${failureText2(result.status, stderr)})` };
|
|
4821
|
+
if (result.status !== 0) return { ok: false, reason: `the freeze command ended badly after it thawed /build (${failureText2(result.status, stderr)})` };
|
|
4588
4822
|
return { ok: true };
|
|
4589
4823
|
}
|
|
4590
4824
|
}
|
|
@@ -4593,7 +4827,7 @@ async function freezeGuest(guest, deadlineSeconds = FREEZE_DEADLINE_SECONDS) {
|
|
|
4593
4827
|
|
|
4594
4828
|
// src/runner/saved-state/microvm.ts
|
|
4595
4829
|
var HELPER_COPY_NAME = "saved-state.ext4";
|
|
4596
|
-
var
|
|
4830
|
+
var failureText3 = (status, stderr) => {
|
|
4597
4831
|
const line2 = stderr.trim().split("\n").at(-1) ?? "";
|
|
4598
4832
|
return `exit ${status}${line2 === "" ? "" : `: ${line2}`}`;
|
|
4599
4833
|
};
|
|
@@ -4632,9 +4866,9 @@ async function saveMicroVmDiskState(input) {
|
|
|
4632
4866
|
const { savedStateMax } = input.limits;
|
|
4633
4867
|
if (savedStateMax === "off") return { ok: false, reason: "runner.housekeeping.savedStateMax is off" };
|
|
4634
4868
|
const stopped = await input.guest.run(["/bin/sh", "-c", guestStopScript()]);
|
|
4635
|
-
if (stopped.status !== 0) return { ok: false, reason: `the guest's processes could not be stopped (${
|
|
4869
|
+
if (stopped.status !== 0) return { ok: false, reason: `the guest's processes could not be stopped (${failureText3(stopped.status, stopped.stderr)})` };
|
|
4636
4870
|
const flushed = await input.guest.run(["sync", "-f", "/build"]);
|
|
4637
|
-
if (flushed.status !== 0) return { ok: false, reason: `the build disk could not be flushed (${
|
|
4871
|
+
if (flushed.status !== 0) return { ok: false, reason: `the build disk could not be flushed (${failureText3(flushed.status, flushed.stderr)})` };
|
|
4638
4872
|
const allocated = allocatedBytes(input.buildDisk);
|
|
4639
4873
|
if (allocated > savedStateMax) {
|
|
4640
4874
|
return { ok: false, reason: `the build disk holds ${formatBytes(allocated)}, more than the ${formatBytes(savedStateMax)} of runner.housekeeping.savedStateMax` };
|
|
@@ -7400,129 +7634,6 @@ function buildReleaseLog(jobDirPath, endStage, scrub) {
|
|
|
7400
7634
|
if (parts.length === 0) return void 0;
|
|
7401
7635
|
return capRunnerLog(scrub(parts.join("\n")) + "\n");
|
|
7402
7636
|
}
|
|
7403
|
-
var SAVED_FOLDERS = ["home", "work"];
|
|
7404
|
-
function stopProcessesScript() {
|
|
7405
|
-
return [
|
|
7406
|
-
"me=$$; uid=$(id -u); n=0; pass=0",
|
|
7407
|
-
"while [ $pass -lt 25 ]; do",
|
|
7408
|
-
' left=""',
|
|
7409
|
-
" for p in /proc/[0-9]*; do",
|
|
7410
|
-
" pid=${p##*/}",
|
|
7411
|
-
' [ "$pid" = "$me" ] && continue',
|
|
7412
|
-
` info=$(sed -n -e 's/^State:[[:space:]]*\\(.\\).*/S=\\1/p' -e 's/^Uid:[[:space:]]*\\([0-9]*\\).*/U=\\1/p' "$p/status" 2>/dev/null) || continue`,
|
|
7413
|
-
' case "$info" in *"S=Z"*) continue ;; esac',
|
|
7414
|
-
// The uid is the last line of `info`, so a match at its end cannot be the longer id 10000 for 1000.
|
|
7415
|
-
' case "$info" in *"U=$uid") left="$left $pid" ;; esac',
|
|
7416
|
-
" done",
|
|
7417
|
-
' [ -z "$left" ] && break',
|
|
7418
|
-
' for pid in $left; do kill -KILL "$pid" 2>/dev/null && n=$((n+1)); done',
|
|
7419
|
-
" pass=$((pass+1))",
|
|
7420
|
-
" sleep 0.2",
|
|
7421
|
-
"done",
|
|
7422
|
-
'[ -z "$left" ] || { echo "$left are still running" >&2; exit 1; }',
|
|
7423
|
-
'echo "stopped $n"'
|
|
7424
|
-
].join("\n");
|
|
7425
|
-
}
|
|
7426
|
-
var HELPER_FLAGS = [
|
|
7427
|
-
"--rm",
|
|
7428
|
-
"--network",
|
|
7429
|
-
"none",
|
|
7430
|
-
"--cap-drop",
|
|
7431
|
-
"ALL",
|
|
7432
|
-
"--cap-add",
|
|
7433
|
-
"CHOWN",
|
|
7434
|
-
"--cap-add",
|
|
7435
|
-
"DAC_OVERRIDE",
|
|
7436
|
-
"--cap-add",
|
|
7437
|
-
"DAC_READ_SEARCH",
|
|
7438
|
-
"--cap-add",
|
|
7439
|
-
"FOWNER",
|
|
7440
|
-
"--security-opt",
|
|
7441
|
-
"no-new-privileges",
|
|
7442
|
-
"--read-only",
|
|
7443
|
-
"--user",
|
|
7444
|
-
"0",
|
|
7445
|
-
"--pids-limit",
|
|
7446
|
-
"256"
|
|
7447
|
-
];
|
|
7448
|
-
function helperArgs(input) {
|
|
7449
|
-
return [
|
|
7450
|
-
...HELPER_FLAGS,
|
|
7451
|
-
"--label",
|
|
7452
|
-
`${RUNNER_LABEL}=${input.runnerId}`,
|
|
7453
|
-
"--mount",
|
|
7454
|
-
`type=volume,src=${input.from},dst=/from,readonly`,
|
|
7455
|
-
"--mount",
|
|
7456
|
-
`type=volume,src=${input.to},dst=/to`,
|
|
7457
|
-
"--entrypoint",
|
|
7458
|
-
"sh",
|
|
7459
|
-
input.image,
|
|
7460
|
-
"-c",
|
|
7461
|
-
input.script
|
|
7462
|
-
];
|
|
7463
|
-
}
|
|
7464
|
-
var SAVE_SCRIPT = `set -e; cp -a ${SAVED_FOLDERS.map((name) => `/from/${name}`).join(" ")} /to/; du -sk /to | cut -f1`;
|
|
7465
|
-
var RESTORE_SCRIPT = `set -e; cp -a ${SAVED_FOLDERS.map((name) => `/from/${name}`).join(" ")} /to/`;
|
|
7466
|
-
function failureText3(result) {
|
|
7467
|
-
const line2 = result.stderr.trim().split("\n").at(-1) ?? "";
|
|
7468
|
-
return `exit ${result.status}${line2 === "" ? "" : `: ${line2}`}`;
|
|
7469
|
-
}
|
|
7470
|
-
async function saveContainerState(input) {
|
|
7471
|
-
const { host } = input;
|
|
7472
|
-
const id = randomBytes(6).toString("hex");
|
|
7473
|
-
const volume = `outerlayer-saved-${id}`;
|
|
7474
|
-
const record = {
|
|
7475
|
-
id,
|
|
7476
|
-
kind: "volume",
|
|
7477
|
-
volume,
|
|
7478
|
-
savedAt: input.now.toISOString(),
|
|
7479
|
-
bytes: 0,
|
|
7480
|
-
baseKey: input.key.baseKey,
|
|
7481
|
-
key: input.key.key,
|
|
7482
|
-
fileHashes: input.key.fileHashes,
|
|
7483
|
-
...input.agentUid === void 0 ? {} : { agentUid: input.agentUid },
|
|
7484
|
-
complete: false
|
|
7485
|
-
};
|
|
7486
|
-
const discard = async (reason) => {
|
|
7487
|
-
const removed = await host.removeVolume(volume).catch((err) => ({ status: -1, stderr: describeCallFailure(err) }));
|
|
7488
|
-
if (removed.status !== 0) {
|
|
7489
|
-
input.log(`the volume ${volume} could not be removed (${failureText3({ status: removed.status, stderr: removed.stderr })}); its record stays so a later pass retries`);
|
|
7490
|
-
return { ok: false, reason };
|
|
7491
|
-
}
|
|
7492
|
-
deleteRecord(input.dir, id);
|
|
7493
|
-
return { ok: false, reason };
|
|
7494
|
-
};
|
|
7495
|
-
try {
|
|
7496
|
-
const noEnv = { literals: {}, passed: {} };
|
|
7497
|
-
const stopped = await host.exec({ container: input.container, user: input.agentUser, env: noEnv, argv: ["sh", "-c", stopProcessesScript()] });
|
|
7498
|
-
if (stopped.status !== 0) return { ok: false, reason: `the build's processes could not be stopped (${failureText3(stopped)})` };
|
|
7499
|
-
input.log(`${stopped.stdout.trim() || "stopped 0"} process${stopped.stdout.trim() === "stopped 1" ? "" : "es"} before saving the state`);
|
|
7500
|
-
const flushed = await host.exec({ container: input.container, user: input.agentUser, env: noEnv, argv: ["sync"] });
|
|
7501
|
-
if (flushed.status !== 0) return { ok: false, reason: `the build's disk could not be flushed (${failureText3(flushed)})` };
|
|
7502
|
-
writeRecord2(input.dir, record);
|
|
7503
|
-
const created = await host.createVolume(volume, { [SAVED_STATE_LABEL]: id, [RUNNER_LABEL]: input.runnerId });
|
|
7504
|
-
if (created.status !== 0) return await discard(`the volume for the saved state could not be made (${failureText3(created)})`);
|
|
7505
|
-
const copied = await host.run(helperArgs({ image: input.image, from: input.buildVolume, to: volume, script: SAVE_SCRIPT, runnerId: input.runnerId }), { logPath: input.logPath });
|
|
7506
|
-
if (copied.status !== 0) return await discard(`the copy into the saved state failed (${failureText3(copied)})`);
|
|
7507
|
-
const kilobytes = Number(copied.stdout.trim().split("\n").at(-1));
|
|
7508
|
-
const done = { ...record, bytes: Number.isFinite(kilobytes) ? kilobytes * 1024 : 0, complete: true };
|
|
7509
|
-
writeRecord2(input.dir, done);
|
|
7510
|
-
return { ok: true, record: done };
|
|
7511
|
-
} catch (err) {
|
|
7512
|
-
return await discard(`the state could not be saved: ${describeCallFailure(err)}`);
|
|
7513
|
-
}
|
|
7514
|
-
}
|
|
7515
|
-
async function restoreContainerState(input) {
|
|
7516
|
-
try {
|
|
7517
|
-
const copied = await input.host.run(helperArgs({ image: input.image, from: input.savedVolume, to: input.targetVolume, script: RESTORE_SCRIPT, runnerId: input.runnerId }), { logPath: input.logPath });
|
|
7518
|
-
if (copied.status !== 0) return { ok: false, reason: `the saved volume could not be copied (${failureText3(copied)})` };
|
|
7519
|
-
return { ok: true };
|
|
7520
|
-
} catch (err) {
|
|
7521
|
-
return { ok: false, reason: `the saved volume could not be copied: ${describeCallFailure(err)}` };
|
|
7522
|
-
}
|
|
7523
|
-
}
|
|
7524
|
-
|
|
7525
|
-
// src/runner/workspace/keep.ts
|
|
7526
7637
|
function recordOf(input, kind, bytes, volume) {
|
|
7527
7638
|
return {
|
|
7528
7639
|
workItemId: input.workItemId,
|
|
@@ -7590,16 +7701,16 @@ async function keepContainerDisk(input) {
|
|
|
7590
7701
|
const dropNew = async () => {
|
|
7591
7702
|
if (!created) return;
|
|
7592
7703
|
const removed = await host.removeVolume(volume).catch((err) => ({ status: -1, stderr: describeCallFailure(err) }));
|
|
7593
|
-
if (removed.status !== 0) input.log(`the volume ${volume} could not be removed (${
|
|
7704
|
+
if (removed.status !== 0) input.log(`the volume ${volume} could not be removed (${failureText({ status: removed.status, stderr: removed.stderr })})`);
|
|
7594
7705
|
};
|
|
7595
7706
|
try {
|
|
7596
7707
|
const made = await host.createVolume(volume, { [WORKSPACE_LABEL]: input.workItemId, [RUNNER_LABEL]: input.runnerId });
|
|
7597
|
-
if (made.status !== 0) return { ok: false, reason: `the volume for the kept disk could not be made (${
|
|
7708
|
+
if (made.status !== 0) return { ok: false, reason: `the volume for the kept disk could not be made (${failureText(made)})` };
|
|
7598
7709
|
created = true;
|
|
7599
7710
|
const copied = await host.run(helperArgs({ image: input.image, from: input.buildVolume, to: volume, script: SAVE_SCRIPT, runnerId: input.runnerId }), { logPath: input.logPath });
|
|
7600
7711
|
if (copied.status !== 0) {
|
|
7601
7712
|
await dropNew();
|
|
7602
|
-
return { ok: false, reason: `the copy into the kept disk failed (${
|
|
7713
|
+
return { ok: false, reason: `the copy into the kept disk failed (${failureText(copied)})` };
|
|
7603
7714
|
}
|
|
7604
7715
|
const kilobytes = Number(copied.stdout.trim().split("\n").at(-1));
|
|
7605
7716
|
const record = recordOf(input, "volume", Number.isFinite(kilobytes) ? kilobytes * 1024 : 0, volume);
|
|
@@ -7608,7 +7719,7 @@ async function keepContainerDisk(input) {
|
|
|
7608
7719
|
const removed = await host.removeVolume(older.record.volume);
|
|
7609
7720
|
if (removed.status !== 0 && !/no such volume/i.test(removed.stderr)) {
|
|
7610
7721
|
await dropNew();
|
|
7611
|
-
return { ok: false, reason: `the work item's older disk could not be replaced: its volume ${older.record.volume} was not removed (${
|
|
7722
|
+
return { ok: false, reason: `the work item's older disk could not be replaced: its volume ${older.record.volume} was not removed (${failureText(removed)})` };
|
|
7612
7723
|
}
|
|
7613
7724
|
}
|
|
7614
7725
|
staging = stagingItemDiskDir(dir);
|
|
@@ -7622,6 +7733,48 @@ async function keepContainerDisk(input) {
|
|
|
7622
7733
|
if (staging !== void 0) rmSync(staging, { recursive: true, force: true });
|
|
7623
7734
|
}
|
|
7624
7735
|
}
|
|
7736
|
+
function saidBy(err) {
|
|
7737
|
+
return err instanceof SandboxError ? describeSandboxError(err) : describeCallFailure(err);
|
|
7738
|
+
}
|
|
7739
|
+
async function keepSandboxDisk2(input) {
|
|
7740
|
+
let dir;
|
|
7741
|
+
try {
|
|
7742
|
+
dir = itemDiskDir(input.configPath, input.organizationId, input.workItemId);
|
|
7743
|
+
} catch (err) {
|
|
7744
|
+
return { ok: false, reason: describeCallFailure(err) };
|
|
7745
|
+
}
|
|
7746
|
+
const { client: client2, snapshotName } = input;
|
|
7747
|
+
const dropNew = async () => {
|
|
7748
|
+
try {
|
|
7749
|
+
await client2.removeSnapshot(snapshotName);
|
|
7750
|
+
} catch (err) {
|
|
7751
|
+
input.log(`the snapshot ${snapshotName} could not be removed (${saidBy(err)}); remove it at the sandbox provider`);
|
|
7752
|
+
}
|
|
7753
|
+
};
|
|
7754
|
+
let staging;
|
|
7755
|
+
try {
|
|
7756
|
+
const saved = await client2.saveSnapshot(input.sandboxId, snapshotName);
|
|
7757
|
+
const record = { ...recordOf(input, "sandbox", 0, input.buildVolume), snapshot: snapshotName, storedBytes: saved.storedBytes };
|
|
7758
|
+
const older = readItemDisk(dir);
|
|
7759
|
+
if (older?.record.snapshot !== void 0) {
|
|
7760
|
+
try {
|
|
7761
|
+
await client2.removeSnapshot(older.record.snapshot);
|
|
7762
|
+
} catch (err) {
|
|
7763
|
+
await dropNew();
|
|
7764
|
+
return { ok: false, reason: `the work item's older disk could not be replaced: its snapshot ${older.record.snapshot} was not removed (${saidBy(err)})` };
|
|
7765
|
+
}
|
|
7766
|
+
}
|
|
7767
|
+
staging = stagingItemDiskDir(dir);
|
|
7768
|
+
finish(input, dir, staging, record);
|
|
7769
|
+
staging = void 0;
|
|
7770
|
+
return { ok: true, record };
|
|
7771
|
+
} catch (err) {
|
|
7772
|
+
await dropNew();
|
|
7773
|
+
return { ok: false, reason: `the sandbox could not be saved: ${saidBy(err)}` };
|
|
7774
|
+
} finally {
|
|
7775
|
+
if (staging !== void 0) rmSync(staging, { recursive: true, force: true });
|
|
7776
|
+
}
|
|
7777
|
+
}
|
|
7625
7778
|
|
|
7626
7779
|
// src/runner/workspace/finish.ts
|
|
7627
7780
|
function noDiskReason(job, config) {
|
|
@@ -7686,6 +7839,31 @@ function containerDiskKeeper(input) {
|
|
|
7686
7839
|
input.log.line(`${input.tag} kept the build disk for the work item: ${formatBytes(kept.record.bytes)} allocated`);
|
|
7687
7840
|
};
|
|
7688
7841
|
}
|
|
7842
|
+
function sandboxDiskKeeper(input) {
|
|
7843
|
+
const state = input.job.sandbox;
|
|
7844
|
+
if (state === void 0) return void 0;
|
|
7845
|
+
const refused2 = noDiskReason(input.job, input.config);
|
|
7846
|
+
if (refused2 !== void 0) {
|
|
7847
|
+
if (input.job.workItemId !== void 0) input.log.line(`${input.tag} the build disk is not kept: ${refused2}`);
|
|
7848
|
+
return void 0;
|
|
7849
|
+
}
|
|
7850
|
+
if (state.sandboxId === "" || state.diskKey === void 0 || state.container.imageId === void 0) return void 0;
|
|
7851
|
+
const { imageId, diskBytes } = state.diskKey;
|
|
7852
|
+
const { sandboxId } = state;
|
|
7853
|
+
const keep = async () => {
|
|
7854
|
+
const kept = await keepSandboxDisk2({ ...target(input, imageId, diskBytes), client: input.client(), sandboxId, snapshotName: input.snapshotName, buildVolume: state.container.volume });
|
|
7855
|
+
if (!kept.ok) throw new Error(kept.reason);
|
|
7856
|
+
input.log.line(`${input.tag} kept the build disk for the work item: snapshot ${kept.record.snapshot} of sandbox ${sandboxId}, ${formatBytes(kept.record.storedBytes)} stored`);
|
|
7857
|
+
};
|
|
7858
|
+
return {
|
|
7859
|
+
container: state.container.container,
|
|
7860
|
+
volume: state.container.volume,
|
|
7861
|
+
imageId: state.container.imageId,
|
|
7862
|
+
runnerId: runnerLabelValue(input.config.configPath),
|
|
7863
|
+
keep,
|
|
7864
|
+
warn: (text2) => input.log.error(`${input.tag} ${text2}`)
|
|
7865
|
+
};
|
|
7866
|
+
}
|
|
7689
7867
|
var SESSION_TAR = "session.tar";
|
|
7690
7868
|
async function guestOf(job, runtime) {
|
|
7691
7869
|
if (job.microvm !== void 0) {
|
|
@@ -8051,6 +8229,7 @@ function environmentFor(input) {
|
|
|
8051
8229
|
if (deps.judgeEnvironment !== void 0) return deps.judgeEnvironment;
|
|
8052
8230
|
if (job.container !== void 0) return containerJudgeEnvironment({ runtime: deps.runtime, config, job, jobDir, log: (line2) => deps.log.line(`${itemTag(job)} ${line2}`) });
|
|
8053
8231
|
if (job.microvm !== void 0) return microVmJudgeEnvironment({ runtime: deps.runtime, job, jobDir });
|
|
8232
|
+
if (job.sandbox !== void 0) return sandboxJudgeEnvironment({ runtime: deps.runtime, job, jobDir, log: (line2) => deps.log.line(`${itemTag(job)} ${line2}`) });
|
|
8054
8233
|
return void 0;
|
|
8055
8234
|
}
|
|
8056
8235
|
async function runJudge(input) {
|
|
@@ -8058,7 +8237,7 @@ async function runJudge(input) {
|
|
|
8058
8237
|
const { runtime, log } = deps;
|
|
8059
8238
|
const tag = `${itemTag(job)}`;
|
|
8060
8239
|
const now = deps.now ?? (() => /* @__PURE__ */ new Date());
|
|
8061
|
-
const repository = job.repository ?? job
|
|
8240
|
+
const repository = job.repository ?? builtOf(job)?.repository;
|
|
8062
8241
|
if (repository === void 0) return;
|
|
8063
8242
|
const repo = repository;
|
|
8064
8243
|
const remoteOf = () => runtime.remoteFor?.(repo) ?? `${runtime.github.gitUrl}/${repo}.git`;
|
|
@@ -8133,7 +8312,7 @@ async function runJudge(input) {
|
|
|
8133
8312
|
log.line(`${tag} judge done (${formatDuration(now().getTime() - startedMs)})`);
|
|
8134
8313
|
}
|
|
8135
8314
|
async function noReview() {
|
|
8136
|
-
const started = job
|
|
8315
|
+
const started = builtOf(job);
|
|
8137
8316
|
if (started === void 0) return { text: "this build ran under a provision hook of the host's own", report: { result: "skipped", reason: "own_provision_hook" } };
|
|
8138
8317
|
const workItem = await readItem();
|
|
8139
8318
|
const open = openPullRequests(workItem);
|
|
@@ -8171,7 +8350,7 @@ async function runJudge(input) {
|
|
|
8171
8350
|
const missing = noAgentProgram(agent.descriptor.label);
|
|
8172
8351
|
const environment = environmentFor(input);
|
|
8173
8352
|
if (environment === void 0) return await fail(check, `${missing}: this build ran outside a container or microVM`);
|
|
8174
|
-
const expected = (job
|
|
8353
|
+
const expected = builtOf(job)?.judgeProgram;
|
|
8175
8354
|
if (expected === void 0) return await fail(check, missing);
|
|
8176
8355
|
const brief = check.judge.text;
|
|
8177
8356
|
if (brief === void 0) return await fail(check, check.builtIn === true ? `this CLI holds no ${check.judge.brief}` : `the brief ${check.judge.brief} is not in the definitions repository`);
|
|
@@ -8221,7 +8400,7 @@ async function runJudge(input) {
|
|
|
8221
8400
|
return await finish2(check, { criteria, items: plan.settled, head, branch, finder, judgeReport: void 0 });
|
|
8222
8401
|
}
|
|
8223
8402
|
let diff = "";
|
|
8224
|
-
const startCommit = (job
|
|
8403
|
+
const startCommit = builtOf(job)?.startCommit;
|
|
8225
8404
|
if (startCommit !== void 0) {
|
|
8226
8405
|
const output = join(scratch, "diff.patch");
|
|
8227
8406
|
const made = await (deps.fetchDiff ?? ((request) => diffBetween(request)))({ remote, dir: join(scratch, "diff"), base: startCommit, head, token: readToken, output });
|
|
@@ -9233,12 +9412,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
9233
9412
|
log.error(`${tag} the host's judge and checks skipped: ${VALUES_NOT_HELD}`);
|
|
9234
9413
|
await reportCodeReview(config, job, { result: "skipped", reason: "variables_lost" }, { fetchImpl: deps.fetchImpl, log, now: deps.now, sleep: deps.sleep });
|
|
9235
9414
|
}
|
|
9236
|
-
if (outcome === "ok" && !isRun && !job.cleanupRan && job.
|
|
9237
|
-
job.judgeNotRun = "the host's judge and checks do not run for a build in a sandbox";
|
|
9238
|
-
log.line(`${tag} the host's judge and checks are not run for a build in a sandbox`);
|
|
9239
|
-
await reportCodeReview(config, job, { result: "skipped", reason: "sandbox" }, { fetchImpl: deps.fetchImpl, log, now: deps.now, sleep: deps.sleep });
|
|
9240
|
-
}
|
|
9241
|
-
if (outcome === "ok" && !isRun && !job.cleanupRan && job.judgeRan !== true && !valuesNotHeld && job.sandbox === void 0) {
|
|
9415
|
+
if (outcome === "ok" && !isRun && !job.cleanupRan && job.judgeRan !== true && !valuesNotHeld) {
|
|
9242
9416
|
setStage(job, jobDirPath, "judge");
|
|
9243
9417
|
job.judgeRan = true;
|
|
9244
9418
|
writeJobFile(jobFilePath, job);
|
|
@@ -9253,7 +9427,7 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
9253
9427
|
log.error(`${tag} the host's judge stopped: ${describeCallFailure(err)} \xB7 continuing`);
|
|
9254
9428
|
}
|
|
9255
9429
|
}
|
|
9256
|
-
if (outcome === "ok" && !isRun && !job.cleanupRan && job.checksRan !== true && !valuesNotHeld
|
|
9430
|
+
if (outcome === "ok" && !isRun && !job.cleanupRan && job.checksRan !== true && !valuesNotHeld) {
|
|
9257
9431
|
setStage(job, jobDirPath, "checks");
|
|
9258
9432
|
job.checksRan = true;
|
|
9259
9433
|
writeJobFile(jobFilePath, job);
|
|
@@ -9325,7 +9499,12 @@ async function finishJob(job, jobDirPath, outcome, config, deps, ending) {
|
|
|
9325
9499
|
let cleanedUp = true;
|
|
9326
9500
|
tunnelRecord = sandboxBuild.runtime.tunnels.get(sandboxBuild.state.buildId)?.record();
|
|
9327
9501
|
try {
|
|
9328
|
-
|
|
9502
|
+
const sandboxRuntime = sandboxBuild.runtime;
|
|
9503
|
+
await cleanupSandbox(
|
|
9504
|
+
sandboxRuntime,
|
|
9505
|
+
sandboxBuild.state,
|
|
9506
|
+
sandboxDiskKeeper({ job, config, runtime: sandboxRuntime, now, log, tag, jobDirPath, client: () => sandboxRuntime.sandbox.client(), snapshotName: itemSnapshotName(runnerLabelValue(config.configPath)) })
|
|
9507
|
+
);
|
|
9329
9508
|
log.line(`${tag} ended sandbox ${sandboxBuild.state.sandboxId}`);
|
|
9330
9509
|
} catch (err) {
|
|
9331
9510
|
cleanedUp = false;
|
|
@@ -9826,8 +10005,12 @@ var bytesOf = (entries) => entries.reduce((sum, entry) => sum + entry.kept.recor
|
|
|
9826
10005
|
function allEntries(configPath) {
|
|
9827
10006
|
return storeScopes(configPath).flatMap((scope) => listItemDisks(configPath, scope).map((kept) => ({ scope, kept })));
|
|
9828
10007
|
}
|
|
9829
|
-
async function removeEntry(entry, removeVolume) {
|
|
10008
|
+
async function removeEntry(entry, removeVolume, removeSnapshot) {
|
|
9830
10009
|
const { record, dir } = entry.kept;
|
|
10010
|
+
if (record.snapshot !== void 0) {
|
|
10011
|
+
if (removeSnapshot === void 0) throw new Error("no sandbox provider is set");
|
|
10012
|
+
await removeSnapshot(record.snapshot);
|
|
10013
|
+
}
|
|
9831
10014
|
if (record.kind === "volume" && record.volume !== void 0) {
|
|
9832
10015
|
if (removeVolume === void 0) throw new Error("Docker is not available");
|
|
9833
10016
|
await removeVolume(record.volume);
|
|
@@ -9864,7 +10047,7 @@ async function removeItemDisks(input) {
|
|
|
9864
10047
|
const gone = /* @__PURE__ */ new Set();
|
|
9865
10048
|
const remove = async (entry, why) => {
|
|
9866
10049
|
try {
|
|
9867
|
-
await removeEntry(entry, input.removeVolume);
|
|
10050
|
+
await removeEntry(entry, input.removeVolume, input.removeSnapshot);
|
|
9868
10051
|
gone.add(entry);
|
|
9869
10052
|
freed += entry.kept.record.bytes;
|
|
9870
10053
|
input.log(`housekeeping: removed the kept disk of work item ${entry.kept.record.workItemId} (${formatBytes(entry.kept.record.bytes)}), ${why}`);
|
|
@@ -9915,7 +10098,7 @@ async function removeItemDisks(input) {
|
|
|
9915
10098
|
}
|
|
9916
10099
|
async function freeItemDisksUntil(input) {
|
|
9917
10100
|
let freed = 0;
|
|
9918
|
-
for (const entry of oldestFirst2(allEntries(input.configPath))) {
|
|
10101
|
+
for (const entry of oldestFirst2(allEntries(input.configPath)).filter((candidate) => candidate.kept.record.kind !== "sandbox")) {
|
|
9919
10102
|
if (input.enough()) break;
|
|
9920
10103
|
try {
|
|
9921
10104
|
await removeEntry(entry, input.removeVolume);
|
|
@@ -10176,6 +10359,7 @@ async function runHousekeeping(options) {
|
|
|
10176
10359
|
limits: { max: options.workspaceMax ?? Number.POSITIVE_INFINITY, orgMax: options.workspaceOrgMax ?? Number.POSITIVE_INFINITY, keepDays: options.workspaceKeepDays ?? DEFAULT_WORKSPACE_KEEP_DAYS },
|
|
10177
10360
|
nowMs,
|
|
10178
10361
|
removeVolume: options.docker === void 0 ? void 0 : (name) => options.docker.removeVolume(name),
|
|
10362
|
+
removeSnapshot: options.removeSnapshot,
|
|
10179
10363
|
...options.itemStates === void 0 ? {} : { itemStates: options.itemStates },
|
|
10180
10364
|
log: (line2) => options.log.line(line2),
|
|
10181
10365
|
error: (line2) => options.log.error(line2)
|
|
@@ -12790,12 +12974,15 @@ function checksIn(root, log, tag) {
|
|
|
12790
12974
|
const unrecorded = loaded.customs.filter((def) => def.level !== "off" && def.declaresEmit === CRITERIA_CHECK && !checks.some((check) => check.name === CRITERIA_CHECK)).map((def) => def.id);
|
|
12791
12975
|
return { checks, unrecorded };
|
|
12792
12976
|
}
|
|
12977
|
+
function builtOf(job) {
|
|
12978
|
+
return job.container ?? job.microvm ?? job.sandbox?.container;
|
|
12979
|
+
}
|
|
12793
12980
|
async function readDefinitions(input, repository, scratch, token, tokens) {
|
|
12794
12981
|
const { config, job, deps } = input;
|
|
12795
12982
|
const tag = `${itemTag(job)}`;
|
|
12796
12983
|
const stage = deps.stage ?? stageGovernedContext;
|
|
12797
12984
|
const controlPlaneUrl = (controlPlane) => deps.runtime.remoteFor?.(controlPlane) ?? `${deps.runtime.github.gitUrl}/${controlPlane}.git`;
|
|
12798
|
-
const governing = (job
|
|
12985
|
+
const governing = builtOf(job)?.governing;
|
|
12799
12986
|
const kept = keptContextTree(input.jobDir, governing);
|
|
12800
12987
|
if (kept !== void 0) return { ok: true, ...checksIn(kept, deps.log, tag) };
|
|
12801
12988
|
const staged = await stage({
|
|
@@ -12821,7 +13008,7 @@ async function readDefinitions(input, repository, scratch, token, tokens) {
|
|
|
12821
13008
|
}
|
|
12822
13009
|
const repo = join(scratch, "repo");
|
|
12823
13010
|
const remote = deps.runtime.remoteFor?.(repository) ?? `${deps.runtime.github.gitUrl}/${repository}.git`;
|
|
12824
|
-
const started = (job
|
|
13011
|
+
const started = builtOf(job)?.startCommit;
|
|
12825
13012
|
const commit = started !== void 0 && started !== "" ? started : job.environment?.recipe?.sourceCommit ?? await deps.runtime.readHead(remote, scratch);
|
|
12826
13013
|
if (commit === void 0) return { ok: false, reason: "the repository's default branch could not be read" };
|
|
12827
13014
|
const fetched = await (deps.fetchCommit ?? fetchCommit)({ remote, dir: repo, commit, token });
|
|
@@ -12838,6 +13025,7 @@ function timeoutAfter(ms, sleep) {
|
|
|
12838
13025
|
});
|
|
12839
13026
|
return { done, cancel: () => clearTimeout(timer) };
|
|
12840
13027
|
}
|
|
13028
|
+
var NO_SANDBOX_CHECKS = "the host's command checks do not run for a build in a sandbox yet: only the criteria judge and the code review do";
|
|
12841
13029
|
function noCleanEnvironment() {
|
|
12842
13030
|
return "the host has no clean environment for checks: this build ran under a provision hook of the host's own, and checks run only in a new container or microVM from a build's image";
|
|
12843
13031
|
}
|
|
@@ -12878,7 +13066,7 @@ async function runHostChecks(input) {
|
|
|
12878
13066
|
const { runtime, log } = deps;
|
|
12879
13067
|
const tag = `${itemTag(job)}`;
|
|
12880
13068
|
const now = deps.now ?? (() => /* @__PURE__ */ new Date());
|
|
12881
|
-
const repository = job.repository ?? job
|
|
13069
|
+
const repository = job.repository ?? builtOf(job)?.repository;
|
|
12882
13070
|
if (repository === void 0) return;
|
|
12883
13071
|
const jobFilePath = join(jobDir, "job.json");
|
|
12884
13072
|
const tokens = runtime.credentials.get(jobDir);
|
|
@@ -12918,6 +13106,7 @@ async function runHostChecks(input) {
|
|
|
12918
13106
|
for (const check of checks) await record(check, "fail", reason, keyTail);
|
|
12919
13107
|
};
|
|
12920
13108
|
try {
|
|
13109
|
+
if (job.sandbox !== void 0) return await failAll(NO_SANDBOX_CHECKS);
|
|
12921
13110
|
if (job.container === void 0 && job.microvm === void 0) return await failAll(noCleanEnvironment());
|
|
12922
13111
|
if (tokens === void 0) return await failAll("the build's repository tokens are no longer held, so the branch cannot be fetched");
|
|
12923
13112
|
if (job.branch === void 0) return await failAll("the build pushed no branch: the claim names none");
|
|
@@ -13167,4 +13356,4 @@ async function runHostChecks(input) {
|
|
|
13167
13356
|
}
|
|
13168
13357
|
}
|
|
13169
13358
|
|
|
13170
|
-
export { ADOPTED_FETCH_RETRY_WINDOW_MS, ALREADY_RELEASED, AttemptLogBook, CRITERIA_CHECK, EXIT_CODE_FILE, GUEST_USAGE_INTERVAL_MS, HELPER_ENV, KIND_LABEL, LEASE_SECONDS, MAX_CHECK_ITEMS_BYTES, MICROVM_COMMAND_DIR, MIN_ENGINE_MAJOR, PLACEHOLDER_MARKER, RENEW_INTERVAL_SECONDS, RunnerInitError, SandboxGoneError, agentCredentialCheck, appendCommandLog, attemptNote, checksIn, claimPermissionProblem, claimRun, commandItems, commandLogOffset, containerCommandExec, createContainerRuntime, createHousekeepingDocker, createLeaseChannel, currentSkillCommand, decideHostBuildSkill, deliverCommitHooks, deliverContainerHooks, deliverExecMaven, deliverJobFiles, deliverSandboxHooks, describeHookEnd, describeMachineDocker, detectMachine, ensureFirecrackerAndJailer, ensureNetworkReady, ensureTunnel, execArgv, execCommandLine, fetchManagedBuildSettings, fetchManagedClaudeKey, filesAreCopied, finishJob, foldSample, formerSkillProblem, formerSkillQueues, freeItemDisksUntil, gitRemoteFor, helperFirecrackerNote, helperSocketPath, holdManagedBuildSettings, holdManagedClaudeKey, hookLimitsFor, hostCommandEnvironment, hostEnvironment, housekeepingDockerIfReachable, inTeardown, installTrust, isContainerTracked, isGroupAlive, isIdle, isIsolatedJob, isJudgeCheck, isMicroVmTracked, isPlaceholderCommand, isReadable, isSandboxTracked, isTimedOut, isTracked, isUnfinished, itemScope, itemTag, jobEnv, jobRecordsClaim, judgeProbe, keepGhConfigCurrent, keptCommitsLine, leaseExpiresAtMs, leaseTimeLeftMs, lifecycleFailureReason, lifecycleSteps, listAdoptableJobs, listItemDisks, listTrackedJobs, listUnreadableJobs, listenOnBroker, makeRecorder, managedBuildSettingsFor, measureDisk, microVmArchSupported, microVmAssetsPinned, microVmCommandLine, microVmOomKills, missingPermissionFix, missingPermissionOf, modellessProblem, modellessQueues, needsAgentCredential, needsBuildSkill, needsRenew, outcomeFromExitCode, parseCpuList, permissionModeProblem, permissionModeProblems, placeholderProblem, placeholderQueues, prepareBranch, prepareResume, prepareRunnerInit, probeCommand, probeHelper, probeMicroVmCommand, probeSandboxCommand, provisionContainer, provisionEnvironment, provisionMicroVm, provisionSandbox, reachDockerStep, readConfigObject, readCpuUsec, readDefinitions, readProvisionOut, readRecords, recordsProofsOnly, recoverLostJobs, releaseLease, removeOldestUntil, renewLease, renewRun, resolveHostBuild, restartSender, restoreSessionIntoContainer, restoreSessionIntoMicroVm, retryFailedReleases, runCommand, runCommandOf, runHook, runHostChecks, runHousekeeping, runIsolation, runRunnerInit, runWithSpawn, sampleGuest, savedStatesDir, scrubReason, serveLease, setStage, setUpRunnerCgroup, shellQuote, startHostServices, startMicroVmCommand, startSandboxCommand, startSender, startServicesFor, stopOrphanedMicroVms, stoppedHelperReason, stripTerminalControls, supportsContainerBuilds, supportsMicroVmBuilds, sweepImageBuilders, sweepSandboxes, testProofIn, timeoutAfter, unfinishedJobs, usableCpus, vmAlive, withTunnelLog, workdirProblem, writeGuestGhConfig, writeRunnerInit };
|
|
13359
|
+
export { ADOPTED_FETCH_RETRY_WINDOW_MS, ALREADY_RELEASED, AttemptLogBook, CRITERIA_CHECK, EXIT_CODE_FILE, GUEST_USAGE_INTERVAL_MS, HELPER_ENV, KIND_LABEL, LEASE_SECONDS, MAX_CHECK_ITEMS_BYTES, MICROVM_COMMAND_DIR, MIN_ENGINE_MAJOR, PLACEHOLDER_MARKER, RENEW_INTERVAL_SECONDS, RunnerInitError, SandboxGoneError, agentCredentialCheck, appendCommandLog, attemptNote, builtOf, checksIn, claimPermissionProblem, claimRun, commandItems, commandLogOffset, containerCommandExec, createContainerRuntime, createHousekeepingDocker, createLeaseChannel, currentSkillCommand, decideHostBuildSkill, deliverCommitHooks, deliverContainerHooks, deliverExecMaven, deliverJobFiles, deliverSandboxHooks, describeHookEnd, describeMachineDocker, detectMachine, ensureFirecrackerAndJailer, ensureNetworkReady, ensureTunnel, execArgv, execCommandLine, fetchManagedBuildSettings, fetchManagedClaudeKey, filesAreCopied, finishJob, foldSample, formerSkillProblem, formerSkillQueues, freeItemDisksUntil, gitRemoteFor, helperFirecrackerNote, helperSocketPath, holdManagedBuildSettings, holdManagedClaudeKey, hookLimitsFor, hostCommandEnvironment, hostEnvironment, housekeepingDockerIfReachable, inTeardown, installTrust, isContainerTracked, isGroupAlive, isIdle, isIsolatedJob, isJudgeCheck, isMicroVmTracked, isPlaceholderCommand, isReadable, isSandboxTracked, isTimedOut, isTracked, isUnfinished, itemScope, itemTag, jobEnv, jobRecordsClaim, judgeProbe, keepGhConfigCurrent, keptCommitsLine, leaseExpiresAtMs, leaseTimeLeftMs, lifecycleFailureReason, lifecycleSteps, listAdoptableJobs, listItemDisks, listTrackedJobs, listUnreadableJobs, listenOnBroker, makeRecorder, managedBuildSettingsFor, measureDisk, microVmArchSupported, microVmAssetsPinned, microVmCommandLine, microVmOomKills, missingPermissionFix, missingPermissionOf, modellessProblem, modellessQueues, needsAgentCredential, needsBuildSkill, needsRenew, outcomeFromExitCode, parseCpuList, permissionModeProblem, permissionModeProblems, placeholderProblem, placeholderQueues, prepareBranch, prepareResume, prepareRunnerInit, probeCommand, probeHelper, probeMicroVmCommand, probeSandboxCommand, provisionContainer, provisionEnvironment, provisionMicroVm, provisionSandbox, reachDockerStep, readConfigObject, readCpuUsec, readDefinitions, readProvisionOut, readRecords, recordsProofsOnly, recoverLostJobs, releaseLease, removeOldestUntil, renewLease, renewRun, resolveHostBuild, restartSender, restoreSessionIntoContainer, restoreSessionIntoMicroVm, retryFailedReleases, runCommand, runCommandOf, runHook, runHostChecks, runHousekeeping, runIsolation, runRunnerInit, runWithSpawn, sampleGuest, savedStatesDir, scrubReason, serveLease, setStage, setUpRunnerCgroup, shellQuote, startHostServices, startMicroVmCommand, startSandboxCommand, startSender, startServicesFor, stopOrphanedMicroVms, stoppedHelperReason, stripTerminalControls, supportsContainerBuilds, supportsMicroVmBuilds, sweepImageBuilders, sweepSandboxes, testProofIn, timeoutAfter, unfinishedJobs, usableCpus, vmAlive, withTunnelLog, workdirProblem, writeGuestGhConfig, writeRunnerInit };
|