mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 21:04:23 +01:00
build(docker): bake chromium runtime libs and refresh pinned tools (#357)
* build(docker): bake chromium runtime libs and refresh pinned tools Install the Chromium runtime libraries in the runner image from Playwright's own resolver instead of a hand-maintained package list, so a Playwright e2e suite runs in the Manager container without root or sudo. PLAYWRIGHT_VERSION is shared with the sandbox guest image and the docker-build workflow. Refresh the remaining pins: node 24.21.0, pnpm 10.28.1, OpenCode 1.18.31, microsandbox 0.7.2 and @opencode-ai/sdk 1.18.31. CI moves to Node 24 to match the image and the documented requirement. uv stays at 0.12.7. The runner previously fetched the unversioned installer URL, so UV_VERSION and the workflow build argument had no effect; it now installs from the versioned URL and asserts the installed version, and the workflow pins the release instead of resolving the newest tag. The pin cannot move past 0.12.7 yet because 0.12.8 and later segfault under qemu-user x86_64 emulation, which is how an arm64 host builds the amd64 platform. * chore(docker): bump the sandbox image digest to the 1.63 build The guest image was rebuilt and republished for Playwright 1.63.0, uv 0.12.7 and pnpm 10.28.1. Moving the digest is what makes deployments adopt it: attestation compares the reference string, so a rebuilt image behind the old digest would never be pulled or recreated. * build(sandbox): align toolchain pins and verify on native runners * feat(sandbox): run Docker with persistent guest storage * chore(docker): pin the Docker-enabled sandbox image
This commit is contained in:
1 parent
50da84541a
commit
65f5bd0e6a
19 files changed
+863
-112
No files matched your search
@@ -14,6 +14,10 @@ import {
|
||||
|
||||
export const WORKSPACE_SANDBOX_NAME = 'ocm-workspace'
|
||||
|
||||
export const SANDBOX_DOCKER_DATA_VOLUME_NAME = 'ocm-workspace-docker-data'
|
||||
export const SANDBOX_DOCKER_DATA_GUEST_PATH = '/var/lib/docker'
|
||||
export const SANDBOX_DOCKER_DATA_SIZE = '20G'
|
||||
|
||||
export const SANDBOX_UNAVAILABLE_PREFIX = 'Sandbox enforcement is on but the sandbox is unavailable: '
|
||||
|
||||
const SANDBOX_PLAN_REQUEST_MARGIN_MS = 30000
|
||||
@@ -171,7 +175,18 @@ export function quoteForShell(value: string): string {
|
||||
return `'${value.replace(/'/g, `'\\''`)}'`
|
||||
}
|
||||
|
||||
function buildSandboxDockerDataMountArg(): string {
|
||||
return `${SANDBOX_DOCKER_DATA_VOLUME_NAME}:${SANDBOX_DOCKER_DATA_GUEST_PATH}:kind=disk,size=${SANDBOX_DOCKER_DATA_SIZE}`
|
||||
}
|
||||
|
||||
function parseSandboxNamedMountSpec(spec: string): { name: string; guest: string } {
|
||||
const [name = '', guest = ''] = spec.split(':')
|
||||
return { name, guest }
|
||||
}
|
||||
|
||||
export function buildSandboxCreateArgs(): string[] {
|
||||
const tmpfsSizeMib = resolveSandboxRuntimeTmpfsSizeMib(parseMemoryMib(ENV.SANDBOX.MEMORY))
|
||||
if (tmpfsSizeMib === null) throw new Error('sandbox memory must be positive to size the runtime tmpfs')
|
||||
return [
|
||||
'run',
|
||||
'-d',
|
||||
@@ -190,6 +205,10 @@ export function buildSandboxCreateArgs(): string[] {
|
||||
'-u',
|
||||
resolveSandboxExecUser(),
|
||||
...sandboxMountRoots().flatMap((root) => ['--mount-dir', `${root}:${root}`]),
|
||||
'--mount-named',
|
||||
buildSandboxDockerDataMountArg(),
|
||||
'--tmpfs',
|
||||
`/tmp:${tmpfsSizeMib}M`,
|
||||
'-w',
|
||||
getReposPath(),
|
||||
'--entrypoint',
|
||||
@@ -353,6 +372,7 @@ function parseSandboxCreateArgs(args: string[]): {
|
||||
cpus: number
|
||||
user: string
|
||||
mountDirs: string[]
|
||||
namedMounts: Array<{ name: string; guest: string }>
|
||||
workdir: string
|
||||
entrypoint: string[]
|
||||
shell: string
|
||||
@@ -361,6 +381,7 @@ function parseSandboxCreateArgs(args: string[]): {
|
||||
} {
|
||||
const labels: Record<string, string> = {}
|
||||
const mountDirs: string[] = []
|
||||
const namedMounts: Array<{ name: string; guest: string }> = []
|
||||
let name = ''
|
||||
let memory = ''
|
||||
let cpus = 0
|
||||
@@ -390,8 +411,10 @@ function parseSandboxCreateArgs(args: string[]): {
|
||||
case '-m': memory = value ?? ''; i += 1; break
|
||||
case '-c': cpus = Number(value); i += 1; break
|
||||
case '--net': i += 1; break
|
||||
case '--tmpfs': i += 1; break
|
||||
case '-u': user = value ?? ''; i += 1; break
|
||||
case '--mount-dir': if (value !== undefined) mountDirs.push(value); i += 1; break
|
||||
case '--mount-named': if (value !== undefined) namedMounts.push(parseSandboxNamedMountSpec(value)); i += 1; break
|
||||
case '-w': workdir = value ?? ''; i += 1; break
|
||||
case '--entrypoint': if (value !== undefined) entrypoint = [value]; i += 1; break
|
||||
case '--shell': if (value !== undefined) shell = value; i += 1; break
|
||||
@@ -400,7 +423,7 @@ function parseSandboxCreateArgs(args: string[]): {
|
||||
if (image === '' && !token.startsWith('-')) image = token
|
||||
}
|
||||
}
|
||||
return { name, labels, memory, cpus, user, mountDirs, workdir, entrypoint, shell, image, cmd }
|
||||
return { name, labels, memory, cpus, user, mountDirs, namedMounts, workdir, entrypoint, shell, image, cmd }
|
||||
}
|
||||
|
||||
export function buildCanonicalSandboxSpec(): Record<string, unknown> {
|
||||
@@ -421,6 +444,15 @@ export function buildCanonicalSandboxSpec(): Record<string, unknown> {
|
||||
quota_mib: null,
|
||||
}
|
||||
})
|
||||
const namedMounts = args.namedMounts.map((mount) => ({
|
||||
type: 'Named',
|
||||
name: mount.name,
|
||||
guest: mount.guest,
|
||||
options: { readonly: false, noexec: false, nosuid: false, nodev: false },
|
||||
stat_virtualization: 'strict',
|
||||
host_permissions: 'private',
|
||||
follow_root_symlinks: false,
|
||||
}))
|
||||
return {
|
||||
name: args.name,
|
||||
image: {
|
||||
@@ -449,7 +481,7 @@ export function buildCanonicalSandboxSpec(): Record<string, unknown> {
|
||||
env: [],
|
||||
labels: args.labels,
|
||||
rlimits: [],
|
||||
mounts: bindMounts,
|
||||
mounts: [...bindMounts, ...namedMounts],
|
||||
patches: [],
|
||||
network: { enabled: true, ports: [] },
|
||||
init: null,
|
||||
@@ -528,7 +560,9 @@ export function buildSandboxProvisionArgs(): string[] {
|
||||
`echo 'ocm-exec:x:${uid}:${gid}:Manager sandbox exec user:/home/ocm-agent:/bin/sh' >> /etc/passwd; ` +
|
||||
`grep -q '^ocm-exec:' /etc/shadow || echo 'ocm-exec:*:19000:0:99999:7:::' >> /etc/shadow; ` +
|
||||
`}; ` +
|
||||
`getent passwd ${uid} >/dev/null || exit 1`,
|
||||
`getent passwd ${uid} >/dev/null || exit 1; ` +
|
||||
`if getent group docker >/dev/null 2>&1; then ` +
|
||||
`usermod -aG docker "$(getent passwd ${uid} | cut -d: -f1)" || exit 1; ` +
|
||||
`fi`,
|
||||
]
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user