How to trigger a build if the last one is old?
Answered
Hello,
So I would like to trigger a build automatically one month after the last one, meaning that if nothing trigger the build (automatically or manually) for a full month it will be triggered by this rule. Is there a way to achieve that?
Thank you in advance,
Alexis
Please sign in to leave a comment.
Hi Alexis,
There is a scheduled trigger that can trigger on a set schedule, but there is no direct way to reschedule it automatically if a build happens. There are two main possibilities here:
-Trigger a build once a month anyway, even if a build happened in the meantime.
-Add a final build step to the build, with a custom script. This custom script calculates the next date, then modifies the current schedule trigger by using the REST API (https://www.jetbrains.com/help/teamcity/rest-api.html#RESTAPI-BuildConfigurationAndTemplateSettings, check in particular the endpoint of <buildTypeId>/triggers). That way, whenever the build is ran it will modify the trigger to happen automatically at your desired timing, and if a new build is ran in the meantime, the new build will reset the trigger.