_env cannot be set for multiple tasks
See original GitHub issueScenario
I am using the mysql
command line executable plus the sh
operator to perform various MySQL operations in DigDag. mysql
automatically checks for MYSQL_PWD
in the environment for the password to use. I am trying to set that environment variable with a Digdag secret.
I’d like to set that once and have the environment set up for child tasks.
Complications
Root _env
Setting an _env
at the .dig
root gives an error.
_env:
MYSQL_PWD: ${secret:mysql.password}
gives error:
Workflow 'td_to_mysql' includes unknown keys: [_env] (model validation)
Parent Task _env
+many_mysql_comments:
_env:
MYSQL_PWD: ${secret:mysql.password}
+command_1:
sh>: mysql --execture "${SQL}"
+command_2:
sh>: mysql --execture "${MORE_SQL}"
gives the error +td_to_mysql+many_mysql_comments contains invalid keys: '_env': "{"_env":{"MYSQL_PWD":"${secret:mysql.password}"}}" (config)
Question
What is the best way to set up the environment so multiple tasks can use it? Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Unable to set environment variables for use in ansible roles
I have playbook running fine when I have environment variables and tasks defined in one single playbook without roles.
Read more >Troubleshoot issues when passing environment variables to ...
I want to troubleshoot issues when passing environment variables to my Amazon Elastic Container Service (Amazon ECS) task.
Read more >Use environment variables | Cloud Run Documentation
When you set environment variables, they are injected into the container and are accessible to your code. Environment variables are set as key/value...
Read more >Introduction to environment variables - CircleCI
Use environment variables to set up various configuration options, and keep your set-up secure with secrets, private keys, and contexts.
Read more >Using Variables - Ansible Documentation
Ansible uses variables to manage differences between systems. With Ansible, you can execute tasks and playbooks on multiple different systems with a single ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I am also suffering with
_env
. I want to configure_env
globally.My scenario is like:
_export: docker:
globally so that I can run all tasks in a docker container.docker-entrypoint.sh
from environment variables so that I can avoid embed secrets into docker images._env
for all tasks.If it is possible to configure
_env
globally with a giant task or with a global_export
, my suffering should be relieved.Hello, @friendofasquid
I’m thinking about another solution. I’ll let you know if I find it.
BTW, I’m maintaining
mysql>
operator. It uses secrets so You don’t need to set MYSQL_PWD environment variables.