You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/01/04 06:01:16 UTC

[GitHub] [airflow] mik-laj commented on issue #13445: BashOperator "env" should extend os envvars and not entirely replacing them

mik-laj commented on issue #13445:
URL: https://github.com/apache/airflow/issues/13445#issuecomment-753774982


   Copying all the environmental ones doesn't sound good to me. There are cases when Airflow has certain environmental variables, and the script should not have these variables, especially since environment variables very often contain secrets.
   
   You can easily add this behavior in your DAG code so I don't see any reason to make suggested change.
   ````bash
       task = BashOperator(
           task_id='runme',
           bash_command='./my-script.sh ',
           dag=dag,
           env={
               'CUSTOM_ENV': 'CUSTOM_VALUE',
               **os.environ
           }
       )
   ````
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org