harshhh817 opened a new pull request, #69885:
URL: https://github.com/apache/airflow/pull/69885

   Fixes `SSHRemoteJobOperator` failing at the cleanup step whenever a custom 
`remote_base_dir` is used.
   
   The operator accepts (and validates) a custom `remote_base_dir` at 
construction time and creates the job directory under it, but 
`build_posix_cleanup_command` / `build_windows_cleanup_command` validated the 
job directory against the hardcoded *default* base directory. Result: the 
remote job runs to completion, then the task fails with
   
   ```
   Invalid job directory: '/tmp-data/airflow-ssh-jobs/af_…'. Expected path 
under '/tmp/airflow-ssh-jobs' for safety.
   ```
   
   **Fix:** thread the operator's configured `remote_base_dir` through the 
cleanup builders into `_validate_job_dir`, falling back to the OS-specific 
default when unset. The safety property is preserved — the `rm -rf` target must 
still live under the base directory the job was actually created under (which 
was itself validated by `_validate_base_dir` at operator construction). Both 
the sync and deferrable (`execute_complete`) cleanup paths go through the fixed 
`_cleanup_remote_job`.
   
   **Tests:** new unit tests for custom-base-dir acceptance and rejection 
(posix + windows), plus an operator-level regression test reproducing the exact 
failure from the issue — verified it fails on `main` and passes with this 
change. Full ssh provider unit suite: 49 passed.
   
   closes: #69813
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (Claude Code)
   
   Generated-by: Claude Code following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   
   ---
   
   * Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#pull-request-guidelines)**
 for more information. Note: commit author/co-author name and email in commits 
become permanently public when merged.
   * For fundamental code changes, an Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals))
 is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License 
Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: 
`{pr_number}.significant.rst`, in 
[airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments).
 You can add this file in a follow-up commit after the PR is created so you 
know the PR number.
   


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