Skip to content

Commit 09b85ee

Browse files
fix(ci): build Bonsai backend images (#10939) (#10951)
fix(ci): build Bonsai backend images Register the Bonsai C++ source path with the backend matrix filter so changes select its image jobs. Also make shared llama.cpp changes rebuild the Bonsai and Turboquant fork images in the actual matrix, not only their test flags.\n\nAssisted-by: Codex:gpt-5 [Codex] Co-authored-by: localai-org-maint-bot <306269227+localai-org-maint-bot@users.noreply.github.com>
1 parent b19afb1 commit 09b85ee

2 files changed

Lines changed: 19 additions & 7 deletions

File tree

backend/cpp/bonsai/patches/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ which branched from upstream some commits earlier. Any upstream API change that
66
gRPC server depends on, but that the fork does not yet carry, is back-ported here as a
77
`*.patch` file and applied to the cloned fork checkout by `../apply-patches.sh`.
88

9+
CI treats both this directory and `backend/cpp/llama-cpp/` as Bonsai inputs, since
10+
the wrapper copies and builds the shared llama.cpp backend sources.
11+
912
Rules:
1013

1114
- One upstream commit (or minimal hunk) per patch, named `NNNN-short-description.patch`.

scripts/changed-backends.js

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ function inferBackendPath(item) {
6363
// via a thin wrapper Makefile. Changes to either dir should retrigger it.
6464
return `backend/cpp/turboquant/`;
6565
}
66+
if (item.dockerfile.endsWith("bonsai")) {
67+
// bonsai is a llama.cpp fork that reuses backend/cpp/llama-cpp sources
68+
// via a thin wrapper Makefile. Changes to either dir should retrigger it.
69+
return `backend/cpp/bonsai/`;
70+
}
6671
if (item.dockerfile.endsWith("privacy-filter")) {
6772
return `backend/cpp/privacy-filter/`;
6873
}
@@ -119,6 +124,15 @@ function getAllBackendPaths() {
119124

120125
const allBackendPaths = getAllBackendPaths();
121126

127+
function backendChanged(backend, pathPrefix, changedFiles) {
128+
if (changedFiles.some(file => file.startsWith(pathPrefix))) return true;
129+
130+
// Fork backends reuse backend/cpp/llama-cpp sources via thin wrappers;
131+
// changes to either directory must retrigger their pipelines.
132+
return (backend === "turboquant" || backend === "bonsai") &&
133+
changedFiles.some(file => file.startsWith("backend/cpp/llama-cpp/"));
134+
}
135+
122136
const token = process.env.GITHUB_TOKEN;
123137
const octokit = new Octokit({ auth: token });
124138

@@ -305,7 +319,7 @@ function emitFilteredMatrix(changedFiles) {
305319
const filtered = includes.filter(item => {
306320
const backendPath = inferBackendPath(item);
307321
if (!backendPath) return false;
308-
return changedFiles.some(file => file.startsWith(backendPath));
322+
return backendChanged(item.backend, backendPath, changedFiles);
309323
});
310324

311325
const filteredDarwin = includesDarwin.filter(item => {
@@ -337,12 +351,7 @@ function emitFilteredMatrix(changedFiles) {
337351

338352
// Per-backend boolean outputs
339353
for (const [backend, pathPrefix] of allBackendPaths) {
340-
let changed = changedFiles.some(file => file.startsWith(pathPrefix));
341-
// turboquant reuses backend/cpp/llama-cpp sources via a thin wrapper;
342-
// changes to either directory should retrigger its pipeline.
343-
if (backend === "turboquant" && !changed) {
344-
changed = changedFiles.some(file => file.startsWith("backend/cpp/llama-cpp/"));
345-
}
354+
const changed = backendChanged(backend, pathPrefix, changedFiles);
346355
fs.appendFileSync(process.env.GITHUB_OUTPUT, `${backend}=${changed ? 'true' : 'false'}\n`);
347356
}
348357
}

0 commit comments

Comments
 (0)