#Accessing env/secret vars in WithExec behavior

1 messages · Page 1 of 1 (latest)

vagrant isle
#

I am seeing some behavior which I don't know is intended. Seems to be behaving consistently for secrets or env vars.

I can access env/secret vars if I do this. (pseudocode)

image.withEnvVariable("TEST", "TEST").withExec([]string{"sh", "-c", "echo $TEST"})

But not like this

image.withEnvVariable("TEST", "TEST").withExec([]string{"echo", "$TEST"})
restive meteor
rigid dagger
#

As Helder mentions, this kind of works as designed beacuse the env var expansion happens within the container through a shell.

this works: https://play.dagger.cloud/playground/Vu43rJhekty

Having said that, as you can see from the issue Helder linked, seems like it'd be very useful to support automatic expansion from the SDK's side.