Skip to content

Commit 5ab835a

Browse files
Copilotmjenkinsx9
andcommitted
Bound cloud-init wait with timeout; fail with clear message on timeout or error
Co-authored-by: mjenkinsx9 <238907794+mjenkinsx9@users.noreply.github.com> Agent-Logs-Url: https://github.com/Mike-Jenkins-Org/PortableCoder/sessions/3e07f31f-0ce7-460c-8081-20c68e9768b5
1 parent f43f50a commit 5ab835a

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

scripts/pcoder.cjs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,18 @@ function buildRemoteRunScript(options) {
12581258

12591259
const lines = [
12601260
'set -e',
1261-
'if command -v cloud-init >/dev/null 2>&1; then cloud-init status --wait 2>/dev/null || true; fi',
1261+
'if command -v cloud-init >/dev/null 2>&1; then',
1262+
' _ci_to=${PCODER_CLOUD_INIT_TIMEOUT:-900}',
1263+
' if ! timeout "$_ci_to" cloud-init status --wait 2>/dev/null; then',
1264+
' _ci_rc=$?',
1265+
' if [ "$_ci_rc" -eq 124 ]; then',
1266+
' echo "pcoder: cloud-init wait exceeded ${_ci_to}s; provisioning may be incomplete" >&2',
1267+
' else',
1268+
' echo "pcoder: cloud-init finished with errors (exit ${_ci_rc}); provisioning may have failed" >&2',
1269+
' fi',
1270+
' exit 1',
1271+
' fi',
1272+
'fi',
12621273
`cd ${shellEscape(remoteProjectPath)}`
12631274
];
12641275

0 commit comments

Comments
 (0)