We want our Teamcity server to do an automatic build whenever someone merges something back to the master branch.
To do this we have created a new VCS Trigger and checked the Trigger a build on each check-in
-option. We have disabled the Quiet period mode
and added a regular expression for the trigger rule. Checking out the Java regex documentation I've created the following regex: ^Merge branch '[a-zA-Z0-9\\p{Punct}]+' into 'master'$
which translates to the following in the Trigger rules textblock: +:comment=^Merge branch '[a-zA-Z0-9\\p{Punct}]+' into 'master'$
or +:comment=^Merge branch '[a-zA-Z0-9\\p{Punct}]+' into 'master'$:**
(I haven't got the slightest idea what :**
should do, but the TC documentation uses this sometimes)
This should match something like:
Merge branch 'test' into 'master'
or
Merge branch 'feature-cs-200' into 'master'
However, the builds are never triggered. Apparently the regex doesn't match the correct pattern.
Any ideas?
Finished... Apparently Teamcity has decided the +:comment=^Merge branch '[a-zA-Z0-9\\p{Punct}]+' into 'master'$
regex is fine now and triggers the builds whenever a commit message matches the examples. Perhaps there was some caching or something else which caused the trigger not to fire.
I am not sure why you want to trigger your builds only on commits that contain the word "merge into" . If someone does a fast-forward
merge, the commit messages won't record a merge message. They will instead record a list of commits. You will never get a list of trigger.
Anyways, if you still want it to run only on merges to master, you can setup a VCS trigger on master(only) and run a teamcity target whenever the message is +:comment=into master:**
If nothing works, you can just try matching the regex '+:comment=Merge branch .*
into master:**'
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.