Writing custom script for Trigger rules
Is there any way to write a script that checks if build should be triggered or not?
From what I've here ( https://confluence.jetbrains.com/display/TCD10/Configuring+VCS+Triggers ), there are only some basics configurations like branch filtering, checking if file changed or if there is a specific word in commit section.
What I wanted to achieve is to run specific build only if my project version changes. I obtain version through bash scripts and set as teamcity parameter.
I wanted to write script (bash or in through Kotlin DSL) that compare last version and current one and if current version changed trigger build. How can I achieve this?
Please sign in to leave a comment.
There isn't an integrated way to run conditional triggers beyond branch filters and trigger rules.
If you can't set some sort of commit message, or specific branch that you want to build matching the above, then I'm afraid there are only 2 options:
-Set up a build configuration that triggers on all, then run as a build step all checks you want to check, then either fail/let the build finish without effect if it doesn't match or trigger a build of the correct configuration via a Finish Build Trigger or the REST API.
-Create your own custom trigger that allows checking for custom rules.
@Denis Lapuente thank you for your answer.
Can you explain what do you mean by "Create your own custom trigger that allows checking for custom rules"
First approach will work but its kinda hacky.
It would be really nice if there was an integrated way to do it in future. Should I create some improvement request task or so?
Regards.
We have this here: https://confluence.jetbrains.com/display/TCD10/Custom+Build+Trigger
While you could send us a feature request, I'm not so sure it will be easy to get it through. There are a large amount of ways to make this work: VCS Tags and trigger on tags, specific "version" branches, comments filtering, user filtering, etc. They usually require little to no extra work as many of this options are already in place in many workflows, while implementing this in TeamCity would bring greater complexity into the triggers. It's not that it's impossible, or even not desirable, but it would take considerable work while there are a number of much easier ways to accomplish the same with the currently available tools.
If you would still like to send us a feature request, please do so in our tracker here: https://youtrack.jetbrains.com/issues/TW