fix: pass go base image through ci plan

This commit is contained in:
UniDesk Codex
2026-07-07 08:16:53 +08:00
parent 221f76a7ef
commit a75a5e160d
2 changed files with 13 additions and 0 deletions
+9
View File
@@ -1170,6 +1170,8 @@ test("v03 planner builds one shared Go env artifact for compatible Go services",
const workbenchRuntime = plan.services.find((service) => service.serviceId === "hwlab-workbench-runtime");
assert.equal(userBilling.envArtifactCacheRef, "127.0.0.1:5000/hwlab/cache/hwlab-go-runtime-env");
assert.equal(workbenchRuntime.envArtifactCacheRef, "127.0.0.1:5000/hwlab/cache/hwlab-go-runtime-env");
assert.equal(userBilling.envReuseRecipe.goBaseImage, "127.0.0.1:5000/hwlab/hwlab-go-env-base:go1-bookworm-slim");
assert.equal(workbenchRuntime.envReuseRecipe.goBaseImage, "127.0.0.1:5000/hwlab/hwlab-go-env-base:go1-bookworm-slim");
assert.equal(userBilling.environmentImage, `127.0.0.1:5000/hwlab/hwlab-go-runtime-env:env-${userBilling.environmentInputHash.slice(0, 12)}`);
assert.equal(workbenchRuntime.environmentImage, userBilling.environmentImage);
assert.equal(workbenchRuntime.sharedEnvBuildSkipped, true);
@@ -1220,10 +1222,12 @@ test("v03 planner ignores Go launcher comment-only changes for env identity", as
test("Go env build path declares base image, stable timing, and late volatile labels", async () => {
const deploy = await readStructuredFile(process.cwd(), path.join(process.cwd(), "deploy/deploy.yaml"));
const recipe = envReuseRecipeForLane(deploy, "v03");
assert.equal(
deploy.lanes?.v03?.envRecipe?.goBaseImage,
"127.0.0.1:5000/hwlab/hwlab-go-env-base:go1-bookworm-slim"
);
assert.equal(recipe.publicRecipe.goBaseImage, "127.0.0.1:5000/hwlab/hwlab-go-env-base:go1-bookworm-slim");
const source = await readFile(path.join(process.cwd(), "scripts/artifact-publish.mjs"), "utf8");
const envDockerfileSource = source.slice(
@@ -1374,6 +1378,11 @@ async function addGoEnvReuseFixture(repo) {
]);
deploy.lanes.v03.bootScripts["hwlab-user-billing"] = "deploy/runtime/boot/hwlab-user-billing.sh";
deploy.lanes.v03.bootScripts["hwlab-workbench-runtime"] = "deploy/runtime/boot/hwlab-workbench-runtime.sh";
deploy.lanes.v03.envRecipe.goOsPackages = ["golang-go"];
deploy.lanes.v03.envRecipe.goBaseImage = "127.0.0.1:5000/hwlab/hwlab-go-env-base:go1-bookworm-slim";
deploy.lanes.v03.envRecipe.runtimeGoModCachePath = "/opt/hwlab-env/go/pkg/mod";
deploy.lanes.v03.envRecipe.runtimeGoBuildCachePath = "/opt/hwlab-env/go/cache";
deploy.lanes.v03.envRecipe.goToolchain = "local";
deploy.lanes.v03.serviceDeclarations["hwlab-user-billing"] = {
runtimeKind: "go-service",
entrypoint: "cmd/hwlab-user-billing/main.go",
+4
View File
@@ -504,6 +504,7 @@ function envReuseRecipeForLaneConfig(laneConfig, lane = "v02") {
const runtimeGoModCachePath = normalizeAbsolutePath(configured.runtimeGoModCachePath);
const runtimeGoBuildCachePath = normalizeAbsolutePath(configured.runtimeGoBuildCachePath);
const goToolchain = normalizeDeclarationString(configured.goToolchain);
const goBaseImage = normalizeDeclarationString(configured.goBaseImage);
if (!runtimeNodeModulesPath) throw new Error(`deploy.lanes.${lane}.envRecipe.runtimeNodeModulesPath must be absolute`);
const additionalEnvPaths = uniqueSorted(normalizeStringList(configured.additionalEnvPaths, []).map(normalizeRepoPath));
const launcherInputPaths = uniqueSorted([
@@ -527,6 +528,7 @@ function envReuseRecipeForLaneConfig(laneConfig, lane = "v02") {
runtimeGoModCachePath,
runtimeGoBuildCachePath,
goToolchain,
goBaseImage,
additionalEnvPaths,
launcherInputPaths,
downloadStack,
@@ -540,6 +542,7 @@ function envReuseRecipeForLaneConfig(laneConfig, lane = "v02") {
runtimeGoModCachePath,
runtimeGoBuildCachePath,
goToolchain,
goBaseImage,
additionalEnvPaths,
downloadStack,
hwpodAliases
@@ -554,6 +557,7 @@ function envReuseRecipeForService(recipe, model) {
runtimeGoModCachePath: _runtimeGoModCachePath,
runtimeGoBuildCachePath: _runtimeGoBuildCachePath,
goToolchain: _goToolchain,
goBaseImage: _goBaseImage,
...nodeRecipe
} = recipe;
return nodeRecipe;