You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Jenkins带参数每月第三个周五23点执行的正确Cron表达式咨询

Jenkins带参数每月第三个周五23点执行的正确Cron表达式咨询

Hey there! Let's fix that cron syntax error you're hitting in your Jenkinsfile.

The issue with your original expression 0 23 ? * FRI#3 is that Jenkins (and specifically the parameterizedCron plugin) doesn't support combining weekday abbreviations like FRI with the #N syntax for specifying the nth occurrence of a weekday. Instead, you need to use the numerical value for Friday paired with the #3 suffix.

Here's the corrected parameterizedCron block you should use:

parameterizedCron('''
0 23 * * 5#3 %INPUT-CHOICE=XXX; HOSTS=YYY
''')

Let me break this down for clarity:

  • 0 = Run at the 0th minute (top of the hour)
  • 23 = Run at 11 PM (23:00 in 24-hour time)
  • * = Run on any day of the month (no need to restrict this since we're using the week-based rule)
  • * = Run in any month
  • 5#3 = Run on the 3rd Friday of the month (5 represents Friday in Jenkins' cron syntax, where 0=Sunday, 1=Monday, ..., 5=Friday, 6=Saturday)

The parameter section %INPUT-CHOICE=XXX; HOSTS=YYY stays exactly as you had it—this will pass those pre-defined parameters to your job when it triggers on the scheduled time.

If you ever need to double-check cron syntax for Jenkins, you can use the built-in helper in your job's configuration: just find the "Build periodically" field and click the question mark icon next to it for detailed valid syntax rules.

备注:内容来源于stack exchange,提问作者SriDev

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.21 15:52:59