Skip to content

Commit e4635a5

Browse files
committed
fix: handle v1 api body argument clearing
1 parent 0a21075 commit e4635a5

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

dag-trigger/airflow-dag-trigger.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ if [ "$AIRFLOW_API_VERSION" = "v2" ]; then
8181
-d "{\"username\": \"$AIRFLOW_USERNAME\", \"password\": \"$AIRFLOW_PASSWORD\"}" \
8282
| jq -r .access_token)
8383
auth_params=(-H "Authorization: Bearer $jwt_token")
84+
extra_arguments="\"logical_date\": null, "
8485
elif [ "$AIRFLOW_API_VERSION" = "v1" ]; then
8586
dag_url="$AIRFLOW_ENDPOINT/api/v1/dags/${dag_id}"
8687
auth_params=(-u "$AIRFLOW_USERNAME:$AIRFLOW_PASSWORD")
88+
extra_arguments=""
8789
fi
8890

8991
is_paused=$(_curl "${auth_params[@]}" "$dag_url" | jq .is_paused)
@@ -100,7 +102,7 @@ run_json=$(_curl "${auth_params[@]}" -X POST \
100102
"$dag_run_url" \
101103
-H 'Cache-Control: no-cache' \
102104
-H 'Content-Type: application/json' \
103-
-d "{\"logical_date\": null, \"conf\": $dag_config}")
105+
-d "{$extra_arguments\"conf\": $dag_config}")
104106
dag_run_id=$(echo "$run_json" | jq -r .dag_run_id)
105107

106108
echo "Started dag run ID: $dag_run_id"

0 commit comments

Comments
 (0)