33 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
96d726c43c fix: retire cron containers past their active deadline
Cron containers were never reaped once they exceeded their active deadline, so a hung cron task ran indefinitely instead of being retired after 24 hours as documented. `cron:run` now also accepts a `--ttl-seconds` argument, matching the one `dokku run` already takes.
2026-08-12 13:11:34 -04:00
Jose Diaz-Gonzalez
ac95225809 fix: prevent host shell injection from app.json cron commands
The docker-local scheduler wrote each app.json cron command verbatim into the dokku user's crontab, where cron's `bash -c` interpreted any shell metacharacters in the command on the host as the dokku user rather than inside the container. The crontab line is now `dokku cron:run <app> <cron-id>`, and the command is resolved from app.json and exec'd inside the container at run time. Commands containing shell operators are also rejected when app.json is validated at deploy time.
2026-05-25 02:14:21 -04:00
Jose Diaz-Gonzalez
20be426125 feat: add support for locking in docker-local commands 2025-11-10 03:07:33 -05:00
Jose Diaz-Gonzalez
f1e3c0764c feat: expose the concurrency policy when fetching cron entries
Also add some validation to ensure invalid values are not specified.
2025-11-10 03:06:24 -05:00
Jose Diaz-Gonzalez
4929272c87 fix: calculate maintenance property correctly 2025-11-10 01:56:07 -05:00
Jose Diaz-Gonzalez
426e6b746a chore: standardize on cron task vs any other naming 2025-11-09 23:16:38 -05:00
Jose Diaz-Gonzalez
f99e3a6c9c feat: add ability to suspend and resume a cron task by ID
This takes advantage of the properties system and allows users to suspend/resume the task at will.
2025-11-09 23:16:38 -05:00
Jose Diaz-Gonzalez
3c7985cd82 feat: track task vs app maintenance separately
We should know _where_ the maintenance value is applied for the end-user's usage
2025-11-09 23:16:38 -05:00
Jose Diaz-Gonzalez
e42df29a79 feat: allow specifying maintenance mode in the file or not
If the app's cron tasks are set to maintenance mode, then the task is set to maintenance mode regardless.
2025-11-09 23:16:38 -05:00
Jose Diaz-Gonzalez
593a4c8170 fix: use correct variable for tasks 2025-11-08 00:09:07 -05:00
Jose Diaz-Gonzalez
12dbbda68c Merge pull request #8082 from dokku/rename-cron-code
Standardize naming in cron code
2025-11-07 23:59:18 -05:00
Jose Diaz-Gonzalez
791f53ab47 refactor: rename command to task in cron code 2025-11-07 22:41:00 -05:00
Jose Diaz-Gonzalez
82cab643a8 chore: standardize on cron task vs any other naming 2025-11-07 22:36:00 -05:00
Jose Diaz-Gonzalez
b598af67b9 refactor: rename CronCommand to DokkuRunCommand
This better reflects what it does.
2025-11-07 22:32:44 -05:00
Jose Diaz-Gonzalez
3915d25d84 refactor: rename cron entry to cron task
This naming better suits what it is we are fetching.
2025-11-07 22:30:54 -05:00
Jose Diaz-Gonzalez
c52e947df1 fix: error out if the appname or app.json is missing when retrieving cron entries 2025-11-07 22:17:13 -05:00
Jose Diaz-Gonzalez
7adeee7086 feat: add ability to list global cron tasks
Closes #7732
2025-09-14 04:38:19 -04:00
Jose Diaz-Gonzalez
885178eed5 feat: turn warnings to failures when running validation against an app.json file 2025-06-23 01:03:10 -04:00
Jose Diaz-Gonzalez
4ae9cca6f1 feat: implement app-json-is-valid plugin trigger 2025-06-19 02:20:02 -04:00
Jose Diaz-Gonzalez
ed851fe399 refactor: warn when invalid cron entries might be written 2025-06-19 01:11:29 -04:00
Jose Diaz-Gonzalez
67003ed469 fix: skip cron entries that are missing a command or a schedule 2025-06-10 23:39:35 -04:00
Jose Diaz-Gonzalez
0f4b5d4305 fix: continue including maintenance mode cron tasks in the cron:list subcommand 2025-06-08 22:34:47 -04:00
Jose Diaz-Gonzalez
c0eb12f572 feat: add ability to set maintenance mode for all cron tasks running for an app
Closes #6953
2025-06-08 22:34:47 -04:00
Jose Diaz-Gonzalez
b93a47c35b feat: add the ability to set a MAILFROM value for local cron emails
Closes #7419
2024-12-17 00:28:21 -05:00
Jose Diaz-Gonzalez
22e1bb6466 feat: add more context to errors in fetching cron entries 2024-02-12 02:37:43 -05:00
Jose Diaz-Gonzalez
8ffb693105 fix: drop -- when calling dokku run for cron-tab templating
Closes #6541
2024-01-29 12:26:38 -05:00
Jose Diaz-Gonzalez
94926d141f refactor: use exported function from appjson module instead of manually parsing
Also add some missing docblocks.
2024-01-18 22:35:12 -05:00
Jose Diaz-Gonzalez
5ffbcf24de fix: always set -- on docker run commands internally to avoid parsing flags on specified commands 2024-01-18 21:00:42 -05:00
Eng Zer Jun
1d186a5a81 refactor(plugins): replace deprecated io/ioutil functions
The io/ioutil package has been deprecated as of Go 1.16 [1]. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

[1]: https://golang.org/doc/go1.16#ioutil
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-12-22 01:59:22 +08:00
Jose Diaz-Gonzalez
f6a3db9c6d docs: fix docblock entries for properties in plugins 2023-12-19 00:34:33 -05:00
Jose Diaz-Gonzalez
c23e878e7d feat: add the ability to specify a custom mailto for all cron output 2023-10-15 20:25:09 -04:00
Jose Diaz-Gonzalez
820883e60c feat: add json format output to cron:list command
This makes it easier to parse output in a machine-readable format - such as when interacting with cron tasks via jq for writing tests.
2023-08-05 10:58:57 -04:00
Jose Diaz-Gonzalez
afc318526c refactor: move crontab writing code to scheduler-docker-local plugin
The implementation was very heavily docker-local specific and thus didn't make a ton of sense to keep in the cron plugin.

This also re-introduces changes from #5908 to parallelize the crontab generation (which is also specific to the docker-local scheduler) that were lost during a rebase.

The impetus for this change was implementing a `cron:run` command. The logic for actually running the command isn't scheduler specific - merely invoking `dokku run` with the appropriate arguments - but all the logic around how the commands were retrieved were, so the change was made pre-emptively.
2023-08-05 10:58:57 -04:00