fix: reset MAILTO after a cron entry that sets its own

A task with its own `MAILTO` is now written in place, followed by a line resetting `MAILTO` to the global value, or to the `dokku` user when none is set, rather than grouped at the end of the crontab, so no other task is mailed to its recipient whatever order the tasks are written in.
This commit is contained in:
Jose Diaz-Gonzalez committed 2026-09-30 17:47:27 -04:00
1 parent f91b1f7fc7
commit b158f482ef
6 files changed
+89 -73

No files matched your search

+7
View File
@@ -132,6 +132,13 @@ EOF
assert_output_contains "MAILTO=ops@example.com"
assert_output_contains "@hourly /bin/false 2>&1 | tee -a /var/log/dokku/log.log"
# the global MAILTO is restored for every task after the one with its own
run /bin/bash -c "grep -A1 -F 'tee -a /var/log/dokku/log.log' /var/spool/cron/crontabs/dokku | tail -n 1"
echo "output: $output"
echo "status: $status"
assert_success
assert_output "MAILTO=global@example.com"
run /bin/bash -c "dokku cron:list --global --format json | jq -r '.[] | select(.schedule == \"@hourly\") | .mailto'"
echo "output: $output"
echo "status: $status"