Jenkins x Gitlab build trigger

เซท Jenkins ให้ build และ deploy app อัตโนมัติ หลังจาก push / merge code ไปที่ branch ‘master’


GitLab project example:

  1. Create GitLab project , (create Access Token in GitLab * you can skip this step)


Create Access Token in GitLab

2. Create Jenkins Project

Add GitLab project URL / Add GitLab’s username and password (or use GitLab token)

Add build trigger

Click ‘Advance’ and Click ‘Generate’ secret token
*Allowed branches’ include branch ‘master‘ for trigger

3. GitLab: Go to Project -> Setting -> Integrations

Add Jenkins’s project URL and Paste secret token which generate from ‘Jenkins’s secret token’

Click ‘Test’ -> select -> ‘Push or Merge event’

Success status after ‘Test’