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

   Several example Dags built their shell command text from values that are 
only known at run time — another task's output, or a Dag param rendered through 
Jinja. Users copy example Dags into real deployments, so the pattern they show 
is the pattern that ships. These examples now keep the command text constant 
and pass the value to the command through `env`, so the shell never parses it 
as part of the command.
   
   Changed examples:
   
   - `example_dag_decorator` — the IP address fetched by `get_ip` reaches 
`echo_ip_info` through `EXTERNAL_IP`.
   - `example_bash_operator` / `example_bash_decorator` — 
`show_dag_folder_stats` reads `describe_dag_folder`'s XComs through `env`.
   - edge3 `integration_test` — `classic_bash` reads `params.mapping_count` 
through `env`.
   
   A new `check-example-dag-shell-commands` prek hook keeps it that way. On 
files under `example_dags/` it flags a `bash_command` (or a `@task.bash` return 
value) built with an f-string, `str.format`, `%` or `+` from a runtime value, 
and a Jinja expression that renders `xcom_pull`, `params` or `dag_run.conf` 
into command text. Literals, module-level constants and context values such as 
`{{ ds }}` are fine. The hook has unit tests under `scripts/tests/ci/prek/`.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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