From 25bc93b3717986ed1cbe2b46514d4c369bdc1709 Mon Sep 17 00:00:00 2001 From: Codex Date: Wed, 3 Jun 2026 07:59:13 +0800 Subject: [PATCH] fix: add ripgrep to runner image --- deploy/container/Containerfile | 2 +- src/selftest/cases/90-runner-image-tools.ts | 34 +++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 src/selftest/cases/90-runner-image-tools.ts diff --git a/deploy/container/Containerfile b/deploy/container/Containerfile index 0402b4d..df93cca 100644 --- a/deploy/container/Containerfile +++ b/deploy/container/Containerfile @@ -11,7 +11,7 @@ ENV AGENTRUN_APP_ROOT=/workspace/agentrun ENV AGENTRUN_BOOT_REPO_URL=http://git-mirror-http.devops-infra.svc.cluster.local/pikasTech/agentrun.git RUN HTTP_PROXY="$HTTP_PROXY" HTTPS_PROXY="$HTTPS_PROXY" NO_PROXY="$NO_PROXY" http_proxy="$HTTP_PROXY" https_proxy="$HTTPS_PROXY" no_proxy="$NO_PROXY" \ - apk add --no-cache ca-certificates curl git github-cli kubectl nodejs openssh-client + apk add --no-cache ca-certificates curl git github-cli kubectl nodejs openssh-client ripgrep COPY package.json bun.lock tsconfig.json ./ RUN HTTP_PROXY="$HTTP_PROXY" HTTPS_PROXY="$HTTPS_PROXY" NO_PROXY="$NO_PROXY" http_proxy="$HTTP_PROXY" https_proxy="$HTTPS_PROXY" no_proxy="$NO_PROXY" \ diff --git a/src/selftest/cases/90-runner-image-tools.ts b/src/selftest/cases/90-runner-image-tools.ts new file mode 100644 index 0000000..fdd9e83 --- /dev/null +++ b/src/selftest/cases/90-runner-image-tools.ts @@ -0,0 +1,34 @@ +import assert from "node:assert/strict"; +import { readFile } from "node:fs/promises"; +import path from "node:path"; +import type { SelfTestCase } from "../harness.js"; + +const requiredRunnerPackages = Object.freeze(["git", "openssh-client", "ripgrep"]); + +const selfTest: SelfTestCase = async (context) => { + const containerfile = await readFile(path.join(context.root, "deploy/container/Containerfile"), "utf8"); + const apkPackages = installedApkPackages(containerfile); + + for (const packageName of requiredRunnerPackages) { + assert.equal(apkPackages.has(packageName), true, `runner image must install ${packageName}`); + } + + return { name: "90-runner-image-tools", tests: ["runner image installs required CLI tools"] }; +}; + +function installedApkPackages(containerfile: string): Set { + const packages = new Set(); + const normalized = containerfile.replace(/\\\s*\r?\n\s*/gu, " "); + + for (const match of normalized.matchAll(/\bapk\s+add\s+--no-cache\s+([^\n]+)/gu)) { + const rawPackages = match[1] ?? ""; + for (const item of rawPackages.split(/\s+/u)) { + const packageName = item.trim(); + if (packageName) packages.add(packageName); + } + } + + return packages; +} + +export default selfTest;