Bug 35479

Summary: Nightly cronjob for plugins should log the plugins that are being run
Product: Koha Reporter: Nick Clemens (kidclamp) <nick>
Component: Command-line UtilitiesAssignee: Kyle M Hall (khall) <kyle>
Status: Pushed to stable --- QA Contact: Tomás Cohen Arazi (tcohen) <tomascohen>
Severity: enhancement    
Priority: P5 - low CC: fridolin.somers, kyle, robin, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.03
Circulation function:
Attachments: Bug 35479: Log start, end, and any failures for each plugin's nightly cronjob
Bug 35479: (follow-up) Match formatting for other cronjob logs
Bug 35479: Log start, end, and any failures for each plugin's nightly cronjob
Bug 35479: (follow-up) Match formatting for other cronjob logs
Bug 35479: (QA follow-up): Tidy
Bug 35479: Log start, end, and any failures for each plugin's nightly cronjob
Bug 35479: (follow-up) Match formatting for other cronjob logs
Bug 35479: (QA follow-up): Tidy

Description Nick Clemens (kidclamp) 2023-12-04 15:59:25 UTC
Bug 31203 adding logging of the start and end of a run to cronjobs.

When running the plugins_nightly.pl cronjob, we should record the plugins that have a nightly method, logging the start and end of each plugins routine
Comment 1 Kyle M Hall (khall) 2023-12-04 17:50:17 UTC
Created attachment 159560 [details] [review]
Bug 35479: Log start, end, and any failures for each plugin's nightly cronjob

When running the plugins_nightly.pl cronjob, we should record the plugins that have a nightly method, logging the start and end of each plugins routine

Test Plan:
1) Enable CronjobLog
2) Install a plugin with a nightly cronjob ( e.g.
   https://github.com/bywatersolutions/koha-plugin-book-list-printer )
3) Run plugins_nightly.pl
4) Note new entries in the cronjob viewer for the start and end of the
   plugin's nightly cronjob run
5) Edit the plugin, add a line like "die 'this is a test';" to the
   plugin's nightly cronjob
6) Run plugins_nightly.pl
7) View the action logs, not the log for the error you added!
Comment 2 Nick Clemens (kidclamp) 2023-12-05 13:47:21 UTC
Created attachment 159581 [details] [review]
Bug 35479: (follow-up) Match formatting for other cronjob logs

To test:
1 - Install the Kitchen Sink plugin
2 - Restart all
3 - Enable 'CronjobLog' system preference
4 - perl misc/cronjobs/plugins_nightly.pl
5 - Note you see on the command line 'Remember to clean the kitchen' - this indicates the plugin cron ran
6 - Tools->log viewer, select 'cronjob' and view
7 - Note you only see 'plugins_nightly.pl' Run and End lines
8 - Apply patches
9 - perl misc/cronjobs/plugins_nightly.pl
10 - View logs agian
11 - Note you now see Run and End lines for 'Koha::Plugin::Com::ByWaterSolutions::KitchenSink'
12 - Confirm they look like the other lines
13 - Edit KitchenSink.pm and add 'die "Kittens";' to the cronjob nightly
14 - perl misc/cronjobs/plugins_nightly.pl
15 - View logs, confirm there is a FAILED error message for the KitchenSink cron
Comment 3 Pedro Amorim 2023-12-18 12:52:22 UTC
Created attachment 159958 [details] [review]
Bug 35479: Log start, end, and any failures for each plugin's nightly cronjob

When running the plugins_nightly.pl cronjob, we should record the plugins that have a nightly method, logging the start and end of each plugins routine

Test Plan:
1) Enable CronjobLog
2) Install a plugin with a nightly cronjob ( e.g.
   https://github.com/bywatersolutions/koha-plugin-book-list-printer )
3) Run plugins_nightly.pl
4) Note new entries in the cronjob viewer for the start and end of the
   plugin's nightly cronjob run
5) Edit the plugin, add a line like "die 'this is a test';" to the
   plugin's nightly cronjob
6) Run plugins_nightly.pl
7) View the action logs, not the log for the error you added!

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Comment 4 Pedro Amorim 2023-12-18 12:52:25 UTC
Created attachment 159959 [details] [review]
Bug 35479: (follow-up) Match formatting for other cronjob logs

To test:
1 - Install the Kitchen Sink plugin
2 - Restart all
3 - Enable 'CronjobLog' system preference
4 - perl misc/cronjobs/plugins_nightly.pl
5 - Note you see on the command line 'Remember to clean the kitchen' - this indicates the plugin cron ran
6 - Tools->log viewer, select 'cronjob' and view
7 - Note you only see 'plugins_nightly.pl' Run and End lines
8 - Apply patches
9 - perl misc/cronjobs/plugins_nightly.pl
10 - View logs agian
11 - Note you now see Run and End lines for 'Koha::Plugin::Com::ByWaterSolutions::KitchenSink'
12 - Confirm they look like the other lines
13 - Edit KitchenSink.pm and add 'die "Kittens";' to the cronjob nightly
14 - perl misc/cronjobs/plugins_nightly.pl
15 - View logs, confirm there is a FAILED error message for the KitchenSink cron

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Comment 5 Pedro Amorim 2023-12-18 12:52:29 UTC
Created attachment 159960 [details] [review]
Bug 35479: (QA follow-up): Tidy

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Comment 6 Tomás Cohen Arazi (tcohen) 2023-12-18 13:12:21 UTC
Created attachment 159966 [details] [review]
Bug 35479: Log start, end, and any failures for each plugin's nightly cronjob

When running the plugins_nightly.pl cronjob, we should record the plugins that have a nightly method, logging the start and end of each plugins routine

Test Plan:
1) Enable CronjobLog
2) Install a plugin with a nightly cronjob ( e.g.
   https://github.com/bywatersolutions/koha-plugin-book-list-printer )
3) Run plugins_nightly.pl
4) Note new entries in the cronjob viewer for the start and end of the
   plugin's nightly cronjob run
5) Edit the plugin, add a line like "die 'this is a test';" to the
   plugin's nightly cronjob
6) Run plugins_nightly.pl
7) View the action logs, not the log for the error you added!

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 7 Tomás Cohen Arazi (tcohen) 2023-12-18 13:12:26 UTC
Created attachment 159967 [details] [review]
Bug 35479: (follow-up) Match formatting for other cronjob logs

To test:
1 - Install the Kitchen Sink plugin
2 - Restart all
3 - Enable 'CronjobLog' system preference
4 - perl misc/cronjobs/plugins_nightly.pl
5 - Note you see on the command line 'Remember to clean the kitchen' - this indicates the plugin cron ran
6 - Tools->log viewer, select 'cronjob' and view
7 - Note you only see 'plugins_nightly.pl' Run and End lines
8 - Apply patches
9 - perl misc/cronjobs/plugins_nightly.pl
10 - View logs agian
11 - Note you now see Run and End lines for 'Koha::Plugin::Com::ByWaterSolutions::KitchenSink'
12 - Confirm they look like the other lines
13 - Edit KitchenSink.pm and add 'die "Kittens";' to the cronjob nightly
14 - perl misc/cronjobs/plugins_nightly.pl
15 - View logs, confirm there is a FAILED error message for the KitchenSink cron

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 8 Tomás Cohen Arazi (tcohen) 2023-12-18 13:12:30 UTC
Created attachment 159968 [details] [review]
Bug 35479: (QA follow-up): Tidy

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 9 Tomás Cohen Arazi (tcohen) 2023-12-18 13:14:06 UTC
Looks good. Didn't test the failure use case, but it makes sense. QA checks happy.
Comment 10 Katrin Fischer 2024-01-31 13:45:51 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 11 Fridolin Somers 2024-02-13 10:24:57 UTC
Small enhancement, I backport

Pushed to 23.11.x for 23.11.03