diff --git a/scripts/artifact-publish.mjs b/scripts/artifact-publish.mjs index 8a3e89c7..c9b1eb29 100644 --- a/scripts/artifact-publish.mjs +++ b/scripts/artifact-publish.mjs @@ -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) {