Integration of jenkins with gitlab

Integration of jenkins with gitlab

March 3, 2021 / Eternal Team

Jenkins with Gitlab is used to create CI/CD pipelines. So that we can automate the build and deployment process using Jenkins jobs.

Don’t know about Jenkins? Go through this article to know how you can install java and Jenkins on AWS.

Step 1: Login to Jenkins Account and install the required plugin.

  • Git plugin
  • Git lab
  • Git lab API
  • Git lab Authentication
  • Credentials plugin

Integration of jenkins with gitlab

Integration of jenkins with gitlab

Step 2: Now create an access token for the integration of Jenkins to GitLab and save the token at any safe place.

Integration of jenkins with gitlab

Integration of jenkins with gitlab

Step 3: Now On jenkins open Manage jenkins -> Manage credentials -> Add credentials

Select Gitlab API token

Integration of jenkins with gitlab

Step 4: Create Jenkins credentials and add Gitlab token

Integration of jenkins with gitlab

Step 5: Go to Manage Jenkins -> Configure system

Integration of jenkins with gitlab

Step 6: Now add Gitlab configuration information.

Integration of jenkins with gitlab

Step 7: Create Public and private key form the system using

‘ssh-keygen’

Integration of jenkins with gitlab

Step 8: Create an SSH key in Gitlab account

Integration of jenkins with gitlab

Step 9: Now add ‘id_rsa.pub’ key to Gitlab account

Integration of jenkins with gitlab

Step 10: Now Create Credentials and ‘id_rsa’ private key to Jenkins

Integration of jenkins with gitlab

Step 11: Add your Gitlab credentials in Jenkins for future use.

Integration of jenkins with gitlab

Step 12: Now create one New project in Gitlab

Integration of jenkins with gitlab

Step 13: Now install the git on our system

Integration of jenkins with gitlab

Step 14: Configure the git clone on our system

Git global setup

 git config --global user.name "something"
 git config --global user.email "something@example.com"
 

Create a new repository

 git clone git@gitlab.com:something/jenkins-git-integration.git
 cd jenkin-git-integration
 Touch test.sh
 git add test.sh
 git commit -m "add testfile"
 git push -u origin master
 

Integration of jenkins with gitlab

Step 15: Our file successfully push to the repository in GitLab

Integration of jenkins with gitlab

Step 16: Run the build now

Integration of jenkins with gitlab

Step 17: Run the build job and open the console output

Integration of jenkins with gitlab

This is how you can successfully integrate Jenkins with GitLab.

AWS-Consulting-Partner

Talk to AWS Certified Consultant

    Want to start a project?

    It’s simple.

    Contact us