The GitHub Actions job "Tests" on airflow.git has failed.
Run started by GitHub user kaxil (triggered by kaxil).

Head commit for run:
838cf401b9a424ad0fbccd5fb8d3040a8f4a7f44 / pankajastro 
<[email protected]>
Fail ``LocalFilesystemToGCSOperator`` if src does not exist (#22772)

Fix #22705.

Fail LocalFilesystemToGCSOperator if the src file does not exist

`src` argument of LocalFilesystemToGCSOperator accept either list of source 
file path or a single source file path as a string. In the case of a single 
source file path we are using 
[glob](https://github.com/apache/airflow/blob/main/airflow/providers/google/cloud/transfers/local_to_gcs.py#L111)
 to parse the file path and glob return empty list if file path does not exist. 
In the next step, we iterate on this list and call [hook 
api](https://github.com/apache/airflow/blob/main/airflow/providers/google/cloud/transfers/local_to_gcs.py#L123)
 to update the file since the list is empty control is not going inside loop 
and task is succeeding even if the source file is not available.

Change 
- Raise an exception if 
[filepath](https://github.com/apache/airflow/blob/main/airflow/providers/google/cloud/transfers/local_to_gcs.py#L111)
 list is empty

After this change below task will fail if example-text.txt does not exist

```
upload_file = LocalFilesystemToGCSOperator(
        task_id="upload_file",
        src="example-text.txt",
        dst=DESTINATION_FILE_LOCATION,
        bucket=BUCKET_NAME,
    )

```

Report URL: https://github.com/apache/airflow/actions/runs/2104615666

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to