- Add credentials
- Add node
- Manage Jenkins --> Manage Credentials --> System --> Global credentials --> Add credentials
- Provide the below info to add credentials
kind:ssh username with private key
Scope:Global
ID:maven_slave
Username:ec2-user
private key:dpo.pem key content
Follow the below setups to add a new slave node to the jenkins
-
Goto Manage Jenkins --> Manage nodes and clouds --> New node --> Permanent Agent
-
Provide the below info to add the node
Number of executors:3
Remote root directory:/home/ec2-user/jenkins
Labels:maven
Usage:Use this node as much as possible
Launch method:Launch agents via SSH
Host:<Private_IP_of_Slave>
Credentials:<Jenkins_Slave_Credentials>
Host Key Verification Strategy:Non verifying Verification Strategy
Availability:Keep this agent online as much as possible
-
Install "multibranch scan webhook trigger" plugin
From dashboard --> manage jenkins --> manage plugins --> Available Plugins
Search for "Multibranch Scan webhook Trigger" plugin and install it. -
Go to multibranch pipeline job job --> configure --> Scan Multibranch Pipeline Triggers --> Scan Multibranch Pipeline Triggers --> Scan by webhook
Trigger token:<token_name>
-
Add webhook to GitHub repository Github repo --> settings --> webhooks --> Add webhook
Payload URl:<jenkins_IP>:8080/multibranch-webhook-trigger/invoke?token=<token_name>
Content type:application/json
Which event would you like to trigger this webhook:just the push event
-
Create Sonar cloud account on https://sonarcloud.io
-
Generate an Authentication token on SonarQube Account --> my account --> Security --> Generate Tokens
-
On Jenkins create credentials Manage Jenkins --> manage credentials --> system --> Global credentials --> add credentials - Credentials type:
Secret text
- ID:sonarqube-key
-
Install SonarQube plugin Manage Jenkins --> Available plugins Search for
sonarqube scanner
-
Configure sonarqube server Manage Jenkins --> Configure System --> sonarqube server Add Sonarqube server - Name:
sonar-server
- Server URL:https://sonarcloud.io/
- Server authentication token:sonarqube-key
-
Configure sonarqube scanner Manage Jenkins --> Global Tool configuration --> Sonarqube scanner Add sonarqube scanner - Sonarqube scanner:
sonar-scanner