Member-only story
Integrating Jenkins Pipeline Job with GitLab Using Jenkinsfile — Learning Jenkins
INTRODUCTION
In the previous tutorial, we integrated Jenkins pipeline with SonarQube + Node.js & pushed the image to Docker Hub using a pipeline script. Now, we will use a Jenkins file as a replacement for the Jenkins pipeline script. This makes it easier for us. if there are changes in the pipeline script, we don’t need to go into Jenkins. Just modify the script in the Jenkinsfile.
SETUP SSH KEY
Generate SSH key pair (public and private) to be added to both Jenkins and GitLab for connection during code pull.
ssh-keygen
SETUP SSH GITLAB
Create deploy keys on GitLab. Copy the SSH public key and add it to the key parameter.
SETUP SSH JENKINS
Add credentials to Jenkins. Copy the SSH private key and add it to the key parameter.