fix: export envreuse download environment (#1132)

This commit is contained in:
Lyon
2026-06-13 17:20:44 +08:00
committed by GitHub
parent ea3b26b895
commit b8e92f669a
+4 -4
View File
@@ -867,7 +867,7 @@ function dockerfile(baseImage, port, labels = []) {
function envReuseDockerfile(baseImage, labels = [], recipe, service = null) {
const normalizedRecipe = normalizeEnvReuseRecipe(recipe);
const runtimeRoot = normalizedRecipe.runtimeNodeModulesPath.replace(/\/node_modules$/u, "");
const downloadEnvPrefix = shellEnvPrefix(downloadEnvPairs(normalizedRecipe.downloadStack));
const downloadEnvPrefix = shellExportPrefix(downloadEnvPairs(normalizedRecipe.downloadStack));
const npmConfigScript = npmDownloadConfigScript(normalizedRecipe.downloadStack);
const goService = service?.runtimeKind === "go-service" || service?.artifactKind === "go-service";
const goCacheEnabled = Boolean(goService && normalizedRecipe.runtimeGoModCachePath && normalizedRecipe.runtimeGoBuildCachePath);
@@ -878,7 +878,7 @@ function envReuseDockerfile(baseImage, labels = [], recipe, service = null) {
`ENV GOPROXY=${goProxy}`,
`ENV GOTOOLCHAIN=${normalizedRecipe.goToolchain || "local"}`
] : [];
const goBuildEnvPrefix = goCacheEnabled ? shellEnvPrefix([
const goBuildEnvPrefix = goCacheEnabled ? shellExportPrefix([
["GOMODCACHE", normalizedRecipe.runtimeGoModCachePath],
["GOCACHE", normalizedRecipe.runtimeGoBuildCachePath],
["GOPROXY", goProxy],
@@ -1019,8 +1019,8 @@ function downloadEnvPairs(stack) {
].filter(([, value]) => value);
}
function shellEnvPrefix(pairs) {
return pairs.length === 0 ? "" : `${pairs.map(([name, value]) => `${name}=${shellQuote(value)}`).join(" ")} `;
function shellExportPrefix(pairs) {
return pairs.length === 0 ? "" : `export ${pairs.map(([name, value]) => `${name}=${shellQuote(value)}`).join(" ")}; `;
}
function npmDownloadConfigScript(stack) {