diff --git a/cli/integration_tests/basic_monorepo/dry_run.t b/cli/integration_tests/basic_monorepo/dry_run.t index 1ad3042907857..fa38e59ae72f2 100644 --- a/cli/integration_tests/basic_monorepo/dry_run.t +++ b/cli/integration_tests/basic_monorepo/dry_run.t @@ -25,42 +25,42 @@ Setup # Part 3 are Tasks to Run, and we have to validate each task separately $ cat tmp-3.txt | grep "my-app#build" -A 15 my-app#build - Task = build - Package = my-app - Hash = 45ec4e15c3dcf5c2 - Cached (Local) = false - Cached (Remote) = false - Directory = apps/my-app - Command = echo 'building' - Outputs = apple.json, banana.txt - Log File = apps/my-app/.turbo/turbo-build.log - Dependencies = - Dependendents = - Inputs Files Considered = 1 - Configured Environment Variables = - Inferred Environment Variables = - Global Environment Variables = SOME_ENV_VAR=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855, VERCEL_ANALYTICS_ID=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + Task = build + Package = my-app + Hash = 45ec4e15c3dcf5c2 + Cached (Local) = false + Cached (Remote) = false + Directory = apps/my-app + Command = echo 'building' + Outputs = apple.json, banana.txt + Log File = apps/my-app/.turbo/turbo-build.log + Dependencies = + Dependendents = + Inputs Files Considered = 1 + Configured Environment Variables = + Inferred Environment Variables = + Global Environment Variables = SOME_ENV_VAR=, VERCEL_ANALYTICS_ID= $ cat tmp-3.txt | grep "util#build" -A 15 util#build - Task = build - Package = util - Hash = c36e55f947cd2d28 - Cached (Local) = false - Cached (Remote) = false - Directory = packages/util - Command = echo 'building' - Outputs = - Log File = packages/util/.turbo/turbo-build.log - Dependencies = - Dependendents = - Inputs Files Considered = 1 - Configured Environment Variables = NODE_ENV=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 - Inferred Environment Variables = - Global Environment Variables = SOME_ENV_VAR=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855, VERCEL_ANALYTICS_ID=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + Task = build + Package = util + Hash = c36e55f947cd2d28 + Cached (Local) = false + Cached (Remote) = false + Directory = packages/util + Command = echo 'building' + Outputs = + Log File = packages/util/.turbo/turbo-build.log + Dependencies = + Dependendents = + Inputs Files Considered = 1 + Configured Environment Variables = NODE_ENV= + Inferred Environment Variables = + Global Environment Variables = SOME_ENV_VAR=, VERCEL_ANALYTICS_ID= # Run the task with NODE_ENV set and see it in summary. Use util package so it's just one package $ NODE_ENV=banana ${TURBO} run build --dry --filter=util | grep "Environment Variables" - Configured Environment Variables = NODE_ENV=b493d48364afe44d11c0165cf470a4164d1e2609911ef998be868d46ade3de4e - Inferred Environment Variables = - Global Environment Variables = SOME_ENV_VAR=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855, VERCEL_ANALYTICS_ID=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + Configured Environment Variables = NODE_ENV=b493d48364afe44d11c0165cf470a4164d1e2609911ef998be868d46ade3de4e + Inferred Environment Variables = + Global Environment Variables = SOME_ENV_VAR=, VERCEL_ANALYTICS_ID= diff --git a/cli/integration_tests/basic_monorepo/dry_run_json.t b/cli/integration_tests/basic_monorepo/dry_run_json.t index acaf13a5025ec..5ca01a9542a01 100644 --- a/cli/integration_tests/basic_monorepo/dry_run_json.t +++ b/cli/integration_tests/basic_monorepo/dry_run_json.t @@ -104,8 +104,8 @@ Setup "configured": [], "inferred": [], "global": [ - "SOME_ENV_VAR=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "VERCEL_ANALYTICS_ID=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "SOME_ENV_VAR=", + "VERCEL_ANALYTICS_ID=" ] }, "hashOfExternalDependencies": "ccab0b28617f1f56" @@ -148,12 +148,12 @@ Setup "framework": "", "environmentVariables": { "configured": [ - "NODE_ENV=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "NODE_ENV=" ], "inferred": [], "global": [ - "SOME_ENV_VAR=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "VERCEL_ANALYTICS_ID=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "SOME_ENV_VAR=", + "VERCEL_ANALYTICS_ID=" ] }, "hashOfExternalDependencies": "ccab0b28617f1f56" @@ -167,8 +167,8 @@ Run again with NODE_ENV set and see the value in the summary. --filter=util work ], "inferred": [], "global": [ - "SOME_ENV_VAR=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "VERCEL_ANALYTICS_ID=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "SOME_ENV_VAR=", + "VERCEL_ANALYTICS_ID=" ] } diff --git a/cli/integration_tests/single_package/dry-run.t b/cli/integration_tests/single_package/dry-run.t index 3f0b7f4351dfe..187b261b36a85 100644 --- a/cli/integration_tests/single_package/dry-run.t +++ b/cli/integration_tests/single_package/dry-run.t @@ -25,7 +25,7 @@ Check Inputs Files Considered = 4 Configured Environment Variables = Inferred Environment Variables = - Global Environment Variables = VERCEL_ANALYTICS_ID=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + Global Environment Variables = VERCEL_ANALYTICS_ID= ResolvedTaskDefinition = {"outputs":["foo"],"cache":true,"dependsOn":[],"inputs":[],"outputMode":"full","env":[],"persistent":false} Framework = @@ -71,7 +71,7 @@ Check "configured": [], "inferred": [], "global": [ - "VERCEL_ANALYTICS_ID=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "VERCEL_ANALYTICS_ID=" ] }, "hashOfExternalDependencies": "" diff --git a/cli/integration_tests/single_package_deps/dry-run.t b/cli/integration_tests/single_package_deps/dry-run.t index 840e83b5d5a21..5bc924bad1e8b 100644 --- a/cli/integration_tests/single_package_deps/dry-run.t +++ b/cli/integration_tests/single_package_deps/dry-run.t @@ -25,7 +25,7 @@ Check Inputs Files Considered = 4 Configured Environment Variables = Inferred Environment Variables = - Global Environment Variables = VERCEL_ANALYTICS_ID=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + Global Environment Variables = VERCEL_ANALYTICS_ID= ResolvedTaskDefinition = {"outputs":["foo"],"cache":true,"dependsOn":[],"inputs":[],"outputMode":"full","env":[],"persistent":false} Framework = test @@ -41,7 +41,7 @@ Check Inputs Files Considered = 4 Configured Environment Variables = Inferred Environment Variables = - Global Environment Variables = VERCEL_ANALYTICS_ID=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + Global Environment Variables = VERCEL_ANALYTICS_ID= ResolvedTaskDefinition = {"outputs":[],"cache":true,"dependsOn":["build"],"inputs":[],"outputMode":"full","env":[],"persistent":false} Framework = @@ -89,7 +89,7 @@ Check "configured": [], "inferred": [], "global": [ - "VERCEL_ANALYTICS_ID=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "VERCEL_ANALYTICS_ID=" ] }, "hashOfExternalDependencies": "" @@ -133,7 +133,7 @@ Check "configured": [], "inferred": [], "global": [ - "VERCEL_ANALYTICS_ID=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "VERCEL_ANALYTICS_ID=" ] }, "hashOfExternalDependencies": "" diff --git a/cli/integration_tests/single_package_no_config/dry-run.t b/cli/integration_tests/single_package_no_config/dry-run.t index edda8b8cf0cdf..b228396e66788 100644 --- a/cli/integration_tests/single_package_no_config/dry-run.t +++ b/cli/integration_tests/single_package_no_config/dry-run.t @@ -25,7 +25,7 @@ Check Inputs Files Considered = 3 Configured Environment Variables = Inferred Environment Variables = - Global Environment Variables = VERCEL_ANALYTICS_ID=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 + Global Environment Variables = VERCEL_ANALYTICS_ID= ResolvedTaskDefinition = {"outputs":[],"cache":false,"dependsOn":[],"inputs":[],"outputMode":"full","env":[],"persistent":false} Framework = @@ -66,7 +66,7 @@ Check "configured": [], "inferred": [], "global": [ - "VERCEL_ANALYTICS_ID=e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "VERCEL_ANALYTICS_ID=" ] }, "hashOfExternalDependencies": "" diff --git a/cli/internal/env/env.go b/cli/internal/env/env.go index 2d4b1211785a5..1d16cc60fe6c8 100644 --- a/cli/internal/env/env.go +++ b/cli/internal/env/env.go @@ -68,8 +68,12 @@ func (evm EnvironmentVariableMap) mapToPair(transformer func(k string, v string) // This is the value used to print out the task hash input, so the values are cryptographically hashed func (evm EnvironmentVariableMap) ToSecretHashable() EnvironmentVariablePairs { return evm.mapToPair(func(k, v string) string { - hashedValue := sha256.Sum256([]byte(v)) - return fmt.Sprintf("%v=%x", k, hashedValue) + if v != "" { + hashedValue := sha256.Sum256([]byte(v)) + return fmt.Sprintf("%v=%x", k, hashedValue) + } + + return fmt.Sprintf("%v=%s", k, "") }) }