riboseinc / aws-sqs-plugin

Jenkins plugin that triggers builds on events that are published via Amazon Simple Queue Service (SQS)
Apache License 2.0
1 stars 1 forks source link

Enhancing the Jenkins aws-sqs-plugin to filter on Git branches #2

Open phuonghuynh opened 7 years ago

phuonghuynh commented 7 years ago

Jenkins' AWS SQS plugin today triggers all Jenkins jobs that subscribe to the SQS queue, but does not perform filtering on Git branches.

The problem occurs in the following scenario:

Here, any code push to the "development" branch, will trigger both "master" and "development" Jenkins jobs, which is very bad especially when there are multiple branches being tracked.

The reason for this is, the Jenkins AWS SQS plugin is not smart enough to trigger the "right" jobs -- the SQS message in fact already tells you what branch has been changed. If we can make the plugin smarter, and provide an extra field when enabling the plugin for the job called "Subscribed branches" (which can default to the branch referred to in the build steps), the plugin only needs to trigger the jobs that match the subscribed branch.

Wildcard should be supported like it is in Jenkin Git Plugin

Therefore, origin/branches* would match origin/branches-foobut not origin/branches/foo, while origin/branches** would match both origin/branches-foo and origin/branches/foo