In Jenkins how can I configure a Jenkins job which is triggered when I have an mr which is merged on my GitLab account, is pulled to my master branch locally, or in that specific folder when I merge a local branch to master or any specified branch???
I doubt you will find a way to manually specify all these conditions for a trigger in a Jenkins job. However, there is an effective way to achieve this.
You need to create a job that runs every time a commit is made. Within the job, define a stage and specify all of your above conditions. If any of the conditions are met, trigger your build job as a downstream job.
In order to find which files had been changed you can use git diff
to perform a diff between your latest commit, and the commit before that. The branch name is available as an in-built variable env.BRANCH_NAME
.