问题
I have setup 2 projects in cc.net for the same web application. A continuous integration project that uses an interval trigger and works fine and a "nightly build" project that uses a cronTrigger. The nightly build essentially builds and deploys the staging/testing server so that people can test without being interrupted with a rebuild every time someone does a commit. What i want to do is have it auto build every morning at 6 am and allow force builds if you want to build any other time. THe cron expression I am using is 0 6 * * *
, which i think is correct and seems to set the "next build time" correctly in cc.net. The problem I am encountering is that if i set the build condition to IfModificationExists then if there are no modifications since the last build, it doesn't build at the scheduled time, which is fine, but as soon as someone commits, it builds, which is not what i want, i want it to wait until the next scheduled time. So I tried setting the build condition to ForceBuild which i thought would just make it build at 6 AM every day regardless of whether there were any commits, but it doesn't it seems to make it build constantly over and over again. What am i missing doing wrong?
EDIT Not sure if this really provides any more usefull info but further to a comment.
<triggers>
<cronTrigger>
<buildCondition>IfModificationExists</buildCondition>
<cronExpression>0 6 * * *</cronExpression>
</cronTrigger>
</triggers>
OR
<triggers>
<cronTrigger>
<buildCondition>ForceBuild</buildCondition>
<cronExpression>0 6 * * *</cronExpression>
</cronTrigger>
</triggers>
回答1:
If you wants to run every day use
<scheduleTrigger time="06:00" buildCondition="ForceBuild" name="Scheduled"></scheduleTrigger>
Someone, knows how to solve this?? I have similar problem running once a month.
回答2:
Taken from: http://build.sharpdevelop.net/ccnet/doc/CCNET/Cron%20Trigger.html
A single expression is composed of 5 space-delimited fields : MINUTES HOURS DAYS MONTHS DAYS-OF-WEEK
Examples:
This trigger will execute 5th day of every month
<triggers>
<cronTrigger>
<cronExpression>0 0 5 * *</cronExpression>
</cronTrigger>
</triggers>
This trigger will execute every day at 5am
<triggers>
<cronTrigger>
<cronExpression>0 5 * * *</cronExpression>
</cronTrigger>
</triggers>
Regards,
Dejan
来源:https://stackoverflow.com/questions/7331583/cruisecontrol-net-crontrigger-confusion