-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strict Environment Handling #4449
Merged
Merged
Changes from 8 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
e928702
First draft.
nathanhammond 45fb7da
incremental
nathanhammond abc01a2
Source data from turbo.json instead.
nathanhammond 5958ed3
Tests for the Go parsing.
nathanhammond 6fb240b
Test for globalPassthroughEnv
nathanhammond da5ac59
Consider the infer variable in the hash.
nathanhammond f45227e
add integration test
nathanhammond 1dde429
more testing
nathanhammond bf3f7e6
Merge branch 'main' into opt-in-env
mehulkar c2c5e67
Avoid global hash changes, update tests and refactor
mehulkar e7cfe6a
Merge branch 'main' into opt-in-env
mehulkar 2357746
Match casing in key name
mehulkar c946929
Ensure systemroot is made available in all modes
mehulkar 92e9fd3
Remove docs for this PR
mehulkar 61e3f1b
revert schema docs
mehulkar 65f35e9
make test work in ci
mehulkar 571f291
rm test for shell being set in task process, not working in ci
mehulkar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
cli/integration_tests/strict_env_vars/global_passthrough_env.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
Setup | ||
$ . ${TESTDIR}/../setup.sh | ||
$ . ${TESTDIR}/setup.sh $(pwd) global_passthrough_env | ||
|
||
Strict + [] | ||
$ ${TURBO} build --env=strict -vv --filter=nothing > /dev/null | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Global turbo version: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: No local turbo binary found at: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: No local turbo binary found at: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Repository Root: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Running command as global turbo (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::cli: pkg_inference_root set to "" (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: Found go binary at "[\-\w\/]+" (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: build tag: (go|rust) (re) | ||
[-0-9:.TWZ+]+ \[INFO] turbo: skipping turbod since we appear to be in a non-interactive context (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: global hash env vars: vars=\["VERCEL_ANALYTICS_ID"] (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: new global hash: value=ef18881222fd6a72 (re) | ||
[-0-9:.TWZ+]+ |[DEBUG] turbo: local cache folder: path="" (re) | ||
No tasks were executed as part of this run. | ||
|
||
Infer + [] | ||
$ ${TURBO} build --env=infer -vv --filter=nothing > /dev/null | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Global turbo version: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: No local turbo binary found at: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: No local turbo binary found at: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Repository Root: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Running command as global turbo (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::cli: pkg_inference_root set to "" (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: Found go binary at "[\-\w\/]+" (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: build tag: (go|rust) (re) | ||
[-0-9:.TWZ+]+ \[INFO] turbo: skipping turbod since we appear to be in a non-interactive context (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: global hash env vars: vars=\["VERCEL_ANALYTICS_ID"] (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: new global hash: value=9cda29cc8ed880a1 (re) | ||
[-0-9:.TWZ+]+ |[DEBUG] turbo: local cache folder: path="" (re) | ||
No tasks were executed as part of this run. | ||
|
||
Loose + [] | ||
$ ${TURBO} build --env=loose -vv --filter=nothing > /dev/null | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Global turbo version: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: No local turbo binary found at: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: No local turbo binary found at: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Repository Root: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Running command as global turbo (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::cli: pkg_inference_root set to "" (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: Found go binary at "[\-\w\/]+" (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: build tag: (go|rust) (re) | ||
[-0-9:.TWZ+]+ \[INFO] turbo: skipping turbod since we appear to be in a non-interactive context (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: global hash env vars: vars=\["VERCEL_ANALYTICS_ID"] (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: new global hash: value=b7e2e8ed3383c982 (re) | ||
[-0-9:.TWZ+]+ |[DEBUG] turbo: local cache folder: path="" (re) | ||
No tasks were executed as part of this run. | ||
|
||
Loose + ["BONUS_VAR"] | ||
$ rm turbo.json | ||
$ mv turbo_loose.json turbo.json | ||
$ ${TURBO} build --env=loose -vv --filter=nothing > /dev/null | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Global turbo version: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: No local turbo binary found at: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: No local turbo binary found at: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Repository Root: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Running command as global turbo (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::cli: pkg_inference_root set to "" (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: Found go binary at "[\-\w\/]+" (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: build tag: (go|rust) (re) | ||
[-0-9:.TWZ+]+ \[INFO] turbo: skipping turbod since we appear to be in a non-interactive context (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: global hash env vars: vars=\["VERCEL_ANALYTICS_ID"] (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: new global hash: value=b7e2e8ed3383c982 (re) | ||
[-0-9:.TWZ+]+ |[DEBUG] turbo: local cache folder: path="" (re) | ||
No tasks were executed as part of this run. |
3 changes: 3 additions & 0 deletions
3
cli/integration_tests/strict_env_vars/global_passthrough_env/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/ | ||
.turbo | ||
.npmrc |
9 changes: 9 additions & 0 deletions
9
cli/integration_tests/strict_env_vars/global_passthrough_env/apps/my-app/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "my-app", | ||
"scripts": { | ||
"build": "echo 'building'" | ||
}, | ||
"dependencies": { | ||
"util": "*" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
cli/integration_tests/strict_env_vars/global_passthrough_env/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "monorepo", | ||
"workspaces": [ | ||
"apps/**", | ||
"packages/**" | ||
] | ||
} |
6 changes: 6 additions & 0 deletions
6
cli/integration_tests/strict_env_vars/global_passthrough_env/packages/util/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "util", | ||
"scripts": { | ||
"build": "echo 'building'" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
cli/integration_tests/strict_env_vars/global_passthrough_env/turbo.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"$schema": "https://turbo.build/schema.json", | ||
"pipeline": { | ||
"build": { | ||
"outputs": ["dist/**"] | ||
} | ||
}, | ||
"globalPassthroughEnv": [] | ||
} |
9 changes: 9 additions & 0 deletions
9
cli/integration_tests/strict_env_vars/global_passthrough_env/turbo_loose.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"$schema": "https://turbo.build/schema.json", | ||
"pipeline": { | ||
"build": { | ||
"outputs": ["dist/**"] | ||
} | ||
}, | ||
"globalPassthroughEnv": ["BONUS_VAR"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/ | ||
.turbo | ||
.npmrc |
9 changes: 9 additions & 0 deletions
9
cli/integration_tests/strict_env_vars/monorepo/apps/my-app/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"name": "my-app", | ||
"scripts": { | ||
"build": "echo 'building'" | ||
}, | ||
"dependencies": { | ||
"util": "*" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "monorepo", | ||
"workspaces": [ | ||
"apps/**", | ||
"packages/**" | ||
] | ||
} |
6 changes: 6 additions & 0 deletions
6
cli/integration_tests/strict_env_vars/monorepo/packages/util/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "util", | ||
"scripts": { | ||
"build": "echo 'building'" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"$schema": "https://turbo.build/schema.json", | ||
"pipeline": { | ||
"build": { | ||
"outputs": ["dist/**"] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]}) | ||
TARGET_DIR=$1 | ||
FIXTURE=$2 | ||
|
||
cp -a ${SCRIPT_DIR}/$2/. ${TARGET_DIR}/ | ||
${SCRIPT_DIR}/../setup_git.sh ${TARGET_DIR} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
Setup | ||
$ . ${TESTDIR}/../setup.sh | ||
$ . ${TESTDIR}/setup.sh $(pwd) monorepo | ||
|
||
Strict with no passthroughEnv opts you into the new hashing behavior. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an optional decision. We could make it use the old hashing behavior here. ("You specified a nonsense combination of options.") If we do that, though, we need to move the EnvMode flag into each individual task hash. |
||
$ ${TURBO} build --env=strict -vv --filter=nothing > /dev/null | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Global turbo version: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: No local turbo binary found at: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: No local turbo binary found at: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Repository Root: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Running command as global turbo (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::cli: pkg_inference_root set to "" (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: Found go binary at "[\-\w\/]+" (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: build tag: (go|rust) (re) | ||
[-0-9:.TWZ+]+ \[INFO] turbo: skipping turbod since we appear to be in a non-interactive context (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: global hash env vars: vars=\["VERCEL_ANALYTICS_ID"] (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: new global hash: value=ef18881222fd6a72 (re) | ||
[-0-9:.TWZ+]+ |[DEBUG] turbo: local cache folder: path="" (re) | ||
No tasks were executed as part of this run. | ||
|
||
Loose with no passthroughEnv also opts you into the new hashing behavior. | ||
$ ${TURBO} build --env=loose -vv --filter=nothing > /dev/null | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Global turbo version: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: No local turbo binary found at: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: No local turbo binary found at: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Repository Root: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Running command as global turbo (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::cli: pkg_inference_root set to "" (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: Found go binary at "[\-\w\/]+" (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: build tag: (go|rust) (re) | ||
[-0-9:.TWZ+]+ \[INFO] turbo: skipping turbod since we appear to be in a non-interactive context (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: global hash env vars: vars=\["VERCEL_ANALYTICS_ID"] (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: new global hash: value=b7e2e8ed3383c982 (re) | ||
[-0-9:.TWZ+]+ |[DEBUG] turbo: local cache folder: path="" (re) | ||
No tasks were executed as part of this run. | ||
|
||
Infer with no passthroughEnv keeps you on the old hashing | ||
$ ${TURBO} build --env=infer -vv --filter=nothing > /dev/null | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Global turbo version: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: No local turbo binary found at: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: No local turbo binary found at: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Repository Root: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Running command as global turbo (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::cli: pkg_inference_root set to "" (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: Found go binary at "[\-\w\/]+" (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: build tag: (go|rust) (re) | ||
[-0-9:.TWZ+]+ \[INFO] turbo: skipping turbod since we appear to be in a non-interactive context (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: global hash env vars: vars=\["VERCEL_ANALYTICS_ID"] (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: global hash: value=f71f6eda617fc880 (re) | ||
[-0-9:.TWZ+]+ |[DEBUG] turbo: local cache folder: path="" (re) | ||
No tasks were executed as part of this run. | ||
|
||
Weird arg for specifying infer, same old hashing | ||
$ ${TURBO} build --env -vv --filter=nothing > /dev/null | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Global turbo version: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: No local turbo binary found at: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: No local turbo binary found at: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Repository Root: .* (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::shim: Running command as global turbo (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turborepo_lib::cli: pkg_inference_root set to "" (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: Found go binary at "[\-\w\/]+" (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: build tag: (go|rust) (re) | ||
[-0-9:.TWZ+]+ \[INFO] turbo: skipping turbod since we appear to be in a non-interactive context (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: global hash env vars: vars=\["VERCEL_ANALYTICS_ID"] (re) | ||
[-0-9:.TWZ+]+ \[DEBUG] turbo: global hash: value=f71f6eda617fc880 (re) | ||
[-0-9:.TWZ+]+ |[DEBUG] turbo: local cache folder: path="" (re) | ||
No tasks were executed as part of this run. |
mehulkar marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has the same hash as the above one, since loose explicitly means "don't pay attention to it."