How to exclude specific date without using complicated Cron Expression in Automation for Jira
Purpose
In Automation for Jira, you can configure the execution period with Schedule Trigger in the following ways.
Fixed date schedule
ex: every X Days/Hours/Minutes
“Advanced(CRON expressions)“ is popular when you specify the time.
However, the configuration of “execute 9:30 AM to 10:00 PM from Monday to Friday in every 15 minutes“ is difficult to express in CRON expressions.
// NG It works "9:00 AM", "9:15 AM", "10:00 PM", "10:15 PM", "10:30 PM" and "10:45 PM"
0 0/15 9-22 * * MON-FRI *
You can also configure with multiple CRON lines in Linux, but “Automation for Jira“ is unable to configure with multiple CRON lines. You need to separate Automation, but it will be complicated.
// "Automation for Jira" can't be setting in multiple lines
0 30,45 9 * * MON-FRI *
0 0/15 10-21 * * MON-FRI *
0 0 22 * * MON-FRI *
Solution
You can exclude the specified date by using Advanced compare condition.
Using the built-in functions “now”, you can get the current date and compare it with the condition, and you can exclude the specified date. Following these configurations, you can get the configuration “execute 9:30 AM to 10:00 PM from Monday to Friday in every 15 minutes“.
CRON expressions
// CRON Expression: It works "9:00 AM", "9:15 AM", "10:00 PM", "10:15 PM", "10:30 PM" and "10:45 PM"
0 0/15 9-22 * * MON-FRI *
Advanced compare condition
Field | Value |
---|---|
First Value | {{now.convertToTimeZone("Asia/Tokyo").shortTime}} |
Condition | does not match regular expressions |
Regular expression | (9:(00|15) AM)|(10:(15|30|45) PM) |
(Tips)Audit Log
When Automation is succeeded, Status will be SUCCESS
When Condition rejected to Automation, Status will be NO ACTIONS PERFORMED