Skip to content

Commit 278c6a9

Browse files
authored
Merge pull request #1 from Mike-Jenkins-Org/copilot/help-with-issue
Fix linux-portable mode: install codex/claude in VM guest via cloud-init and switch CI to Blacksmith
2 parents a2c5524 + 5ab835a commit 278c6a9

7 files changed

Lines changed: 44 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212

1313
jobs:
1414
portable-ci:
15-
runs-on: depot-ubuntu-24.04
15+
runs-on: blacksmith-2vcpu-ubuntu-2404
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v4

.github/workflows/claude-pr-runner.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
contains(github.event.comment.body, '@claude')) ||
3131
(github.event_name == 'pull_request_review' &&
3232
contains(github.event.review.body, '@claude'))
33-
runs-on: depot-ubuntu-24.04
33+
runs-on: blacksmith-2vcpu-ubuntu-2404
3434
steps:
3535
- name: Checkout
3636
uses: actions/checkout@v4

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ Windows smoke test:
4040

4141
## CI
4242
- GitHub Actions workflow: `.github/workflows/ci.yml`
43-
- Runner target: Depot-hosted runner label `depot-ubuntu-24.04`
43+
- Runner target: Blacksmith runner label `blacksmith-2vcpu-ubuntu-2404`
4444

4545
## Claude PR Runner
4646
- Workflow: `.github/workflows/claude-pr-runner.yml`
4747
- Trigger: mention `@claude` in PR comments/reviews (or run manually via `workflow_dispatch`)
48-
- Runner target: Depot-hosted runner label `depot-ubuntu-24.04`
48+
- Runner target: Blacksmith runner label `blacksmith-2vcpu-ubuntu-2404`
4949
- Configure one auth secret:
5050
- `ANTHROPIC_API_KEY` (API key mode), or
5151
- `CLAUDE_CODE_OAUTH_TOKEN` (OAuth mode)

docs/RUNBOOKS.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,15 @@ Backend spec:
5858
## Linux-Portable Run Flow
5959
1. `pcoder` starts/ensures VM via `start-vm.cmd`.
6060
2. VM launcher attempts WHPX acceleration, then auto-fallback to TCG.
61-
3. Project is copied into guest over SCP.
62-
4. Tool command runs over SSH in guest project directory.
63-
5. Project is copied back to host after run (unless `--no-sync-back`).
61+
3. On first boot, cloud-init installs Node.js, `codex`, and `claude` CLI tools (may take several minutes).
62+
4. `pcoder run` waits for cloud-init to complete before running the tool.
63+
5. Project is copied into guest over SCP.
64+
6. Tool command runs over SSH in guest project directory.
65+
7. Project is copied back to host after run (unless `--no-sync-back`).
66+
67+
**First-boot note:** The first time you boot the VM, cloud-init provisions the guest (creates the `portable` user, installs Node.js and the coding CLI tools). This can take 5–15 minutes depending on network speed and host performance. `pcoder run` automatically waits for cloud-init to finish before launching the tool. Subsequent boots skip provisioning and start much faster.
68+
69+
**Smoke check with tool checks:** Run `scripts/runtime/windows/smoke-check.cmd` after the first boot completes to verify that `codex` and `claude` are installed in the guest. Use `-SkipToolChecks` to skip tool presence checks if only testing VM boot and SSH connectivity.
6470

6571
Acceleration override (Windows troubleshooting):
6672
- `PCODER_VM_ACCEL_MODE=auto` (default): try WHPX then fallback to TCG if launch fails.

runtime/linux/cloud-init/user-data

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
#cloud-config
22
users:
33
- name: portable
4-
sudo: ALL=(ALL) NOPASSWD:ALL
54
shell: /bin/bash
5+
sudo: ALL=(ALL) NOPASSWD:ALL
6+
lock_passwd: true
7+
groups:
8+
- sudo
9+
ssh_authorized_keys:
10+
- <SSH_PUBLIC_KEY_PLACEHOLDER>
611
ssh_pwauth: false
712

8-
# Placeholder for VM provisioning during image bake.
13+
packages:
14+
- nodejs
15+
- npm
16+
17+
runcmd:
18+
- npm install -g @openai/codex @anthropic-ai/claude-code

scripts/pcoder.cjs

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

12591259
const lines = [
12601260
'set -e',
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',
12611273
`cd ${shellEscape(remoteProjectPath)}`
12621274
];
12631275

scripts/runtime/windows/start-vm.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ users:
106106
ssh_authorized_keys:
107107
- $PublicKey
108108
ssh_pwauth: false
109+
110+
packages:
111+
- nodejs
112+
- npm
113+
114+
runcmd:
115+
- npm install -g @openai/codex @anthropic-ai/claude-code
109116
"@
110117
$userData | Out-File -Encoding utf8 -FilePath $cloudInitUserDataPath
111118
}

0 commit comments

Comments
 (0)