omriAl opened a new issue #17240:
URL: https://github.com/apache/airflow/issues/17240


   **Apache Airflow version**: 1.10.15
   
   
   **Kubernetes version (if you are using kubernetes)** (use `kubectl version`):
   `Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.6", 
GitCommit:"96fac5cd13a5dc064f7d9f4f23030a6aeface6cc", GitTreeState:"clean", 
BuildDate:"2019-08-19T11:13:49Z", GoVersion:"go1.12.9", Compiler:"gc", 
Platform:"linux/amd64"}
   Server Version: version.Info{Major:"1", Minor:"18+", 
GitVersion:"v1.18.16-eks-7737de", 
GitCommit:"7737de131e58a68dda49cdd0ad821b4cb3665ae8", GitTreeState:"clean", 
BuildDate:"2021-03-10T21:33:25Z", GoVersion:"go1.13.15", Compiler:"gc", 
Platform:"linux/amd64"}`
   **Environment**:
   
   - **Cloud provider or hardware configuration**: EKS
   - **OS** (e.g. from /etc/os-release): Debian GNU/Linux 10 (buster)
   - **Kernel** (e.g. `uname -a`): Linux airflow-web-84bf9f8865-s5xxg 
4.14.209-160.335.amzn2.x86_64 #1 SMP Wed Dec 2 23:31:46 UTC 2020 x86_64 
   - **Install tools**: helm (fork of the official chart)
   - **Others**:
   **What happened**:
   We started using `env` variable in the built-in bash_operator. the goal was 
to add a single variable to be used as part of the command. but once using the 
variable, it caused all of the other environment variables to be ignored.
   
   **What you expected to happen**:
   we expected that any environment variable we are adding to this operator 
will be added or updated.
   the expectation are wrong from this variable.
   **How to reproduce it**:
   
   `import os
   os.environ["foo"] = "bar"
   from datetime import datetime
   from airflow import DAG
   from airflow.models import TaskInstance
   from airflow.operators.bash_operator import BashOperator
   
   dag = DAG(dag_id='anydag', start_date=datetime.now())
   
   #unsuccessfull example:
   task = BashOperator(bash_command='if [ -z "$foo" ]; then exit 1; fi',env= 
{"foo1" : "bar1"},dag=dag, task_id='test')
   ti = TaskInstance(task=task, execution_date=datetime.now())
   result = task.execute(ti.get_template_context())
   
   
   #successfull example:
   task = BashOperator(bash_command='if [ -z "$foo" ]; then exit 1; 
fi',dag=dag, task_id='test1')
   ti = TaskInstance(task=task, execution_date=datetime.now())
   result = task.execute(ti.get_template_context())`
   
   **Anything else we need to know**:
   this happens every time it runs.
   


-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to