<@U06HBGN1SA0> is it possible to inject secrets in...
# ask-ai
@Glime is it possible to inject secrets into a Shell task?
Based on the provided context, it appears that injecting secrets into a ShellTask directly is not straightforward or may not be supported in the same manner as other task types in Flyte. A discussion post from the Flyte community forum indicates a user having trouble using a ShellTask with secrets, suggesting limitations or challenges with this approach. However, there is a workaround mentioned in another discussion post where a user has managed to use secrets within a shell task by first retrieving the secret value in a separate task and then passing it to the ShellTask. This approach involves generating an environment variable name from the secret and then using it within the ShellTask. To summarize, while directly injecting secrets into a ShellTask might not be directly supported or may present challenges, a workaround involving intermediate tasks to handle secrets and pass them to the ShellTask as environment variables can be considered. --- This is an AI-generated response, take its recommendations with caution. Please help us improve the model accuracy by giving this response a thumbs up/thumbs down reaction. Sources https://discuss.flyte.org/t/1031/hey-all-i-m-having-trouble-using-a-shelltask-with-secrets-in/ https://discuss.flyte.org/t/12112334/is-there-a-recommended-way-to-use-secret-in-a-https-docs-fly/ ๐Ÿ‘ button ๐Ÿ‘Ž button
Secrets are supported in shell tasks, they are under given env vars
@Ketan (kumare3) I suppose thereโ€™s a predictable way the
map to the env var name?
Copy code
import os
from typing import Tuple

import flytekit
from flytekit import Secret, task, workflow
from flytekit.testing import SecretsManager

secret = Secret(