Skip to content

Commit ac73ce6

Browse files
committed
add env example
1 parent 0eb4582 commit ac73ce6

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

executor_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,14 @@ func TestSecretVars(t *testing.T) {
295295
),
296296
WithTask("test-deferred-secret"),
297297
)
298+
NewExecutorTest(t,
299+
WithName("env secret limitation"),
300+
WithExecutorOptions(
301+
task.WithDir("testdata/secrets"),
302+
),
303+
WithTask("test-env-secret-limitation"),
304+
)
305+
298306
}
299307

300308
func TestRequires(t *testing.T) {

testdata/secrets/Taskfile.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,17 @@ tasks:
5050
- echo "Starting task"
5151
- defer: echo "Cleanup with secret={{.DEFERRED_SECRET}} and app={{.APP_NAME}}"
5252
- echo "Main command executed"
53+
54+
test-env-secret-limitation:
55+
desc: Test showing that env vars with secret flag are NOT masked (limitation)
56+
env:
57+
SECRET_TOKEN:
58+
value: "env-secret-token-123"
59+
secret: true # This flag does NOT work for env vars!
60+
PUBLIC_ENV: "public-value"
61+
cmds:
62+
# Templates {{.VAR}} don't work with env - they're empty
63+
- echo "Token via template is {{.SECRET_TOKEN}}"
64+
# Shell $VAR works but is NOT masked (env vars not in template system)
65+
- echo "Token via shell is $SECRET_TOKEN"
66+
- echo "Public env is {{.PUBLIC_ENV}}"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
task: [test-env-secret-limitation] echo "Token via template is "
2+
Token via template is
3+
task: [test-env-secret-limitation] echo "Token via shell is $SECRET_TOKEN"
4+
Token via shell is env-secret-token-123
5+
task: [test-env-secret-limitation] echo "Public env is "
6+
Public env is

0 commit comments

Comments
 (0)