Niladri
Niladri

Reputation: 135

Jenkins Build Trigger with Gitlab Webhook

I am able to generate build trigger url and able to call build operation via Gitlab Web hook.

But the build operation is calling in each commit irrespective of any branch. But I want to trigger build operation for a specific branch commit. Means want to execute build only if any code pushed to a specific branch.

Upvotes: 0

Views: 374

Answers (1)

danielc103
danielc103

Reputation: 1

In Gitlab yaml you can specify each job to trigger on certain branches or excluding branches

https://docs.gitlab.com/ee/ci/yaml/#only-and-except

job_name:
  script:
    - rake spec
    - coverage
  stage: test
  only:
    - master
  tags:
    - ruby
    - postgres
  allow_failure: true

The above yaml would only execute on master

Upvotes: 0

Related Questions