Merge pull request #83 from pikasTech/fix/issue82-runner-ripgrep
fix: AgentRun runner 镜像补齐 ripgrep
This commit is contained in:
@@ -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" \
|
||||
|
||||
@@ -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<string> {
|
||||
const packages = new Set<string>();
|
||||
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;
|
||||
Reference in New Issue
Block a user