gitlab-jenkins-ci-cd-project-and-webhook-setup-part-2.md
devcondadevopsgitlab-jenkins-ci-cd-project-and-webhook-setup-part-2.md

GitLab + Jenkins CI/CD: Project and Webhook Setup (Part 2)

Written by

in

GitLab basic settings

Korean language

Log in → click the profile icon (top right) → PreferencesLocalizationLanguage → Korean.

Approve users as admin

  • Log in as admin
  • Open the menu toggle (top left) → Admin (admin page below)
  • DashboardUsersPending approvalApprove

Create group and project

Create group: Admin page → GroupsNew group → create group1.

Add members: Admin page → GroupsAdd users to group.

Create project: Admin page → ProjectsNew projectCreate blank project → create test.

Change and add branches

  • In the test project: SettingsRepositoryDefault branch → change main to another name (e.g. dev)
  • FilesBranchesNew branch → add release

Unprotect the default branch (allow force push)

test project → SettingsRepositoryProtected Branches → Expand → Unprotect.

Create a GitLab token

  • test project → SettingsAccess tokens → check all permissions → create
  • You get a token starting with glpat-

GitLab webhook settings (1)

Allow webhooks to the local network: Admin page → SettingsNetworkOutbound requests → enable Allow requests to the local network from web hooks and services.

Jenkins basic settings

Install plugins

Manage JenkinsPluginsAvailable plugins → search and install git server and gitlab.

Tool configuration

Manage JenkinsGlobal Tool Configuration:

  • JDK — enter the path of an already installed JDK (e.g. /usr/bin/java), or choose an installable version (Install automatically requires an Oracle login).
    Check with readlink /etc/alternatives/java or alternatives --config java.
  • Git — name: default, path: git

System settings — GitLab credentials

Manage JenkinsManage credentialsSystemGlobal credentialsAdd CredentialsGitLab API token → paste the glpat- token → create.

Pipeline GitLab credentials

Manage JenkinsManage credentialsSystemGlobal credentialsAdd CredentialsUsername with password → enter the GitLab root account → create.

GitLab connection

Manage JenkinsSystemGitLab → enter the GitLab host IP → Credentials → select the GitLab API token → Test connection.

Create a pipeline

Create a pipeline named test_pipeline:

  • Manage JenkinsNew ItemPipeline
  • Select the GitLab connection you created
  • Build Triggers → check Build when a change is pushed to GitLab. GitLab webhook URL example: http://HOST_IP:8888/project/test
  • AdvancedSecret tokenGenerate (example: bd4ac97175546df0)
  • PipelinePipeline script → try sample pipeline → Hello World → Save

GitLab webhook settings (2)

Admin page → ProjectsSettingsWebhooks:

  • URL: http://HOST_IP:8888/project/test
  • Secret token: bd4ac97175546df0
  • Under Push events, enter dev in the branch filter box
  • Enable Enable SSL verification
  • Save → TestPush events

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *