Jenkins job builder gitlab trigger is ignored

I suspect you may need to put the triggers in the job itself, rather than under /project/jobs.

With the triggers under the project key, I experience the same symptom you do. None of my triggers get created in Jenkins. Moving the triggers section into a job fixes the problem for me.

This yaml will build a jenkins job called builder-test with the "Build when a change is pushed to GitLab" box checked:

- scm:
    name: gitlab
    scm:
      - git:
          url: https://gitlab.com/user/repo-name.git
          branches:
            - origin/master
- job:
    name: builder-test
    project-type: freestyle
    description: "builder-test desc"
    scm:
      - gitlab            
    triggers:
      - gitlab: 
          trigger-push: true
- project:
    name: builder-test-project
    jobs:
      - 'builder-test'

Tested on Jenkins 2.32.3 using GitLab plugin 1.5.1 and JJB 1.6.2


In your question you have said that the Build when a change is pushed to GitLab option is "not enabled". On the configure page Jenkins will disable options in drop down lists when those options are already selected (i.e. being used) in the current job configuration.

The trigger-push: true option is probably what is driving this in your case.

Are you saying that your job is not actually being built when changes are pushed to the GitLab repository?

After your clarification:

There is a full example here for versions 1.1.26 and later.

triggers:
  - gitlab:
      trigger-push: false
      trigger-merge-request: false
      trigger-open-merge-request-push: both
      ci-skip: false
      set-build-description: false
      add-note-merge-request: false
      add-vote-merge-request: false
      add-ci-message: true
      allow-all-branches: true
      include-branches:
        - 'master'
        - 'master2'
        - 'local-test'
      exclude-branches:
        - 'broken-test'
        - 'master-foo'

Does your code incorporate the branches to include?