Tích hợp Jenkins với Gitlab - quan1997ap/Backend-app-note GitHub Wiki
https://news.cloud365.vn/ci-cd-phan-3-huong-dan-tich-hop-jenkins-va-gitlab/
Bước 1: Khởi tạo Repo
Bước 2: Tạo gitlab user + gen Accesss token ( Scope API )
+ Token gitlab: glpat-A8CDZsNRB4MUErCPFhQA
Bước 3: Tạo mới User Gitlab trên Jenkins
- Create user
- Login -> Manage Jenkin -> Configure
+ API Token -> Add new token
+ Token jenkin: 112c64ed46b277392a6c5e682c759cb96b
Bước 4: Install gitlab plugin cho jenkin
Bước 5: Cấu hình Credential
Manage Jenkins => Configure System => Gitlab
- GitLab connection
+ Gitlab host Url: https://gitlab.com
+ Credential => Add => Jenkin => Khái báo Credentials Gitlab mới ( Kind gitlab token )
Note: Để xoá Credential : https://d2d4-118-70-184-62.ngrok-free.app/manage/credentials/store/system/domain/_/
+ Chọn Credentials chọn GitLab API token (GitLab API token)
+ Test connection
+ Save
Bước 6: Tạo Pipe
- New Item => Chọn loại Pipeline
- Tab General
+ Chọn Discard old builds + Nhập Max # of builds to keep: 5
+ GitLab Connection => Chọn connection đã tạo ở Bước 5
+ Build Triggers => Build when a change is pushed to GitLab. GitLab webhook URL: https://d2d4-118-70-184-62.ngrok-free.app/project/Gitlab-webhook-2
- Advanced Project Options
+ Pipeline script from SCM
+ SCM chọn Git
+ Repositories > Repository URL => https://gitlab.com/quan1997ap/webhook-2
Bước 7: Cấu hình webhook
- URL : http://quan1997ap:[email protected]/project/webhook-2
- Trigger: chọn Push events và Merge request events