Merge pull request #2423 from pikasTech/issue-2420-gobase-recipe
修复 Go base image recipe 透传
This commit is contained in:
@@ -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");
|
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(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(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(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.environmentImage, userBilling.environmentImage);
|
||||||
assert.equal(workbenchRuntime.sharedEnvBuildSkipped, true);
|
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 () => {
|
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 deploy = await readStructuredFile(process.cwd(), path.join(process.cwd(), "deploy/deploy.yaml"));
|
||||||
|
const recipe = envReuseRecipeForLane(deploy, "v03");
|
||||||
assert.equal(
|
assert.equal(
|
||||||
deploy.lanes?.v03?.envRecipe?.goBaseImage,
|
deploy.lanes?.v03?.envRecipe?.goBaseImage,
|
||||||
"127.0.0.1:5000/hwlab/hwlab-go-env-base:go1-bookworm-slim"
|
"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 source = await readFile(path.join(process.cwd(), "scripts/artifact-publish.mjs"), "utf8");
|
||||||
const envDockerfileSource = source.slice(
|
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-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.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"] = {
|
deploy.lanes.v03.serviceDeclarations["hwlab-user-billing"] = {
|
||||||
runtimeKind: "go-service",
|
runtimeKind: "go-service",
|
||||||
entrypoint: "cmd/hwlab-user-billing/main.go",
|
entrypoint: "cmd/hwlab-user-billing/main.go",
|
||||||
|
|||||||
@@ -504,6 +504,7 @@ function envReuseRecipeForLaneConfig(laneConfig, lane = "v02") {
|
|||||||
const runtimeGoModCachePath = normalizeAbsolutePath(configured.runtimeGoModCachePath);
|
const runtimeGoModCachePath = normalizeAbsolutePath(configured.runtimeGoModCachePath);
|
||||||
const runtimeGoBuildCachePath = normalizeAbsolutePath(configured.runtimeGoBuildCachePath);
|
const runtimeGoBuildCachePath = normalizeAbsolutePath(configured.runtimeGoBuildCachePath);
|
||||||
const goToolchain = normalizeDeclarationString(configured.goToolchain);
|
const goToolchain = normalizeDeclarationString(configured.goToolchain);
|
||||||
|
const goBaseImage = normalizeDeclarationString(configured.goBaseImage);
|
||||||
if (!runtimeNodeModulesPath) throw new Error(`deploy.lanes.${lane}.envRecipe.runtimeNodeModulesPath must be absolute`);
|
if (!runtimeNodeModulesPath) throw new Error(`deploy.lanes.${lane}.envRecipe.runtimeNodeModulesPath must be absolute`);
|
||||||
const additionalEnvPaths = uniqueSorted(normalizeStringList(configured.additionalEnvPaths, []).map(normalizeRepoPath));
|
const additionalEnvPaths = uniqueSorted(normalizeStringList(configured.additionalEnvPaths, []).map(normalizeRepoPath));
|
||||||
const launcherInputPaths = uniqueSorted([
|
const launcherInputPaths = uniqueSorted([
|
||||||
@@ -527,6 +528,7 @@ function envReuseRecipeForLaneConfig(laneConfig, lane = "v02") {
|
|||||||
runtimeGoModCachePath,
|
runtimeGoModCachePath,
|
||||||
runtimeGoBuildCachePath,
|
runtimeGoBuildCachePath,
|
||||||
goToolchain,
|
goToolchain,
|
||||||
|
goBaseImage,
|
||||||
additionalEnvPaths,
|
additionalEnvPaths,
|
||||||
launcherInputPaths,
|
launcherInputPaths,
|
||||||
downloadStack,
|
downloadStack,
|
||||||
@@ -540,6 +542,7 @@ function envReuseRecipeForLaneConfig(laneConfig, lane = "v02") {
|
|||||||
runtimeGoModCachePath,
|
runtimeGoModCachePath,
|
||||||
runtimeGoBuildCachePath,
|
runtimeGoBuildCachePath,
|
||||||
goToolchain,
|
goToolchain,
|
||||||
|
goBaseImage,
|
||||||
additionalEnvPaths,
|
additionalEnvPaths,
|
||||||
downloadStack,
|
downloadStack,
|
||||||
hwpodAliases
|
hwpodAliases
|
||||||
@@ -554,6 +557,7 @@ function envReuseRecipeForService(recipe, model) {
|
|||||||
runtimeGoModCachePath: _runtimeGoModCachePath,
|
runtimeGoModCachePath: _runtimeGoModCachePath,
|
||||||
runtimeGoBuildCachePath: _runtimeGoBuildCachePath,
|
runtimeGoBuildCachePath: _runtimeGoBuildCachePath,
|
||||||
goToolchain: _goToolchain,
|
goToolchain: _goToolchain,
|
||||||
|
goBaseImage: _goBaseImage,
|
||||||
...nodeRecipe
|
...nodeRecipe
|
||||||
} = recipe;
|
} = recipe;
|
||||||
return nodeRecipe;
|
return nodeRecipe;
|
||||||
|
|||||||
Reference in New Issue
Block a user