build: centralize the pinned opencode version (#1075)

Keep OpenCode version selection predictable by reading a single repo-wide constant and packaging that pin into orchestrator builds. Remove env and latest-release fallbacks so desktop, workers, snapshots, and CI stay aligned.

Co-authored-by: Omar McAdam <omar@OpenWork-Studio.localdomain>
This commit is contained in:
Omar McAdam
2026-03-20 12:30:24 -07:00
committed by GitHub
parent a9bf75da0a
commit db10a7b5ba
30 changed files with 186 additions and 392 deletions

View File

@@ -35,7 +35,7 @@ SNAPSHOT_DISK="${DAYTONA_SNAPSHOT_DISK:-8}"
LOCAL_IMAGE_TAG="${DAYTONA_LOCAL_IMAGE_TAG:-openwork-daytona-snapshot:${SNAPSHOT_NAME//[^a-zA-Z0-9_.-]/-}}"
OPENWORK_ORCHESTRATOR_VERSION="${OPENWORK_ORCHESTRATOR_VERSION:-$(node -e 'const fs=require("fs"); const pkg=JSON.parse(fs.readFileSync(process.argv[1], "utf8")); process.stdout.write(String(pkg.version));' "$ROOT_DIR/apps/orchestrator/package.json")}"
OPENCODE_VERSION="${OPENCODE_VERSION:-$(node -e 'const fs=require("fs"); const pkg=JSON.parse(fs.readFileSync(process.argv[1], "utf8")); process.stdout.write(String(pkg.opencodeVersion));' "$ROOT_DIR/apps/orchestrator/package.json")}"
OPENCODE_VERSION="$(node -e 'const fs=require("fs"); const parsed=JSON.parse(fs.readFileSync(process.argv[1], "utf8")); process.stdout.write(String(parsed.opencodeVersion || "").trim().replace(/^v/, ""));' "$ROOT_DIR/constants.json")"
echo "Building local image $LOCAL_IMAGE_TAG" >&2
echo "- openwork-orchestrator@$OPENWORK_ORCHESTRATOR_VERSION" >&2

View File

@@ -21,6 +21,11 @@ const desktopPkg = readJson(resolve(root, "apps", "desktop", "package.json"));
const orchestratorPkg = readJson(
resolve(root, "apps", "orchestrator", "package.json"),
);
const pinnedOpencodeVersion = String(
readJson(resolve(root, "constants.json")).opencodeVersion ?? "",
)
.trim()
.replace(/^v/, "");
const serverPkg = readJson(resolve(root, "apps", "server", "package.json"));
const opencodeRouterPkg = readJson(
resolve(root, "apps", "opencode-router", "package.json"),
@@ -40,10 +45,7 @@ const versions = {
server: serverPkg.version ?? null,
orchestrator: orchestratorPkg.version ?? null,
opencodeRouter: opencodeRouterPkg.version ?? null,
opencode: {
desktop: desktopPkg.opencodeVersion ?? null,
orchestrator: orchestratorPkg.opencodeVersion ?? null,
},
opencode: pinnedOpencodeVersion || null,
opencodeRouterVersionPinned: desktopPkg.opencodeRouterVersion ?? null,
orchestratorOpenworkServerRange:
orchestratorPkg.dependencies?.["openwork-server"] ?? null,
@@ -101,17 +103,15 @@ addCheck(
versions.opencodeRouter === versions.opencodeRouterVersionPinned,
`${versions.opencodeRouterVersionPinned ?? "?"} vs ${versions.opencodeRouter ?? "?"}`,
);
if (versions.opencode.desktop || versions.opencode.orchestrator) {
if (versions.opencode) {
addCheck(
"OpenCode version matches (desktop/orchestrator)",
versions.opencode.desktop &&
versions.opencode.orchestrator &&
versions.opencode.desktop === versions.opencode.orchestrator,
`${versions.opencode.desktop ?? "?"} vs ${versions.opencode.orchestrator ?? "?"}`,
"OpenCode version pin exists",
Boolean(versions.opencode),
String(versions.opencode),
);
} else {
addWarning(
"OpenCode version is not pinned (apps/desktop + apps/orchestrator). Sidecar bundling will default to the latest OpenCode release at build time.",
"OpenCode version is not pinned in constants.json.",
);
}