Project Devsecops
Project Devsecops
Project Devsecops
Steps:-
References
Now, lets get started and dig deeper into each of these
steps :-
2A — To Install Jenkins
3A — Install Plugin
3C — Create a Job
pipeline {
agent any
tools{
jdk 'jdk17'
maven 'maven3'
}
stages{
stage("Git Checkout"){
steps{
git branch: 'main', changelog: false, poll: false, url:
'https://github.com/Aj7Ay/Petclinic.git'
}
}
stage("Compile"){
steps{
sh "mvn clean compile"
}
}
}
}
The stage view would look like this,
Lets goto our Pipeline and add Sonar-qube Stage in our Pipeline Script
pipeline {
agent any
tools{
jdk 'jdk17'
maven 'maven3'
}
stages{
stage("Git Checkout"){
steps{
git branch: 'main', changelog: false, poll: false, url:
'https://github.com/Aj7Ay/Petclinic.git'
}
}
stage("Compile"){
steps{
sh "mvn clean compile"
}
}
stage("Sonarqube Analysis "){
steps{
script {
withSonarQubeEnv(credentialsId: 'Sonar-token') {
sh 'mvn sonar:sonar'
}
}
}
}
stage("quality gate"){
steps {
script {
waitForQualityGate abortPipeline: false, credentialsId: 'Sonar-token'
}
}
}
}
}
}
Click on Build now, you will see the stage view like this
To see the report, you can goto Sonarqube Server and goto Projects.
You can see the report has been generated and the status shows as
passed. You can see that there are 15K lines. To see detailed report, you
can go to issues.
Now goto configure → Pipeline and add this stage to your pipeline
stage("OWASP Dependency Check"){
steps{
dependencyCheck additionalArguments: '--scan ./ --format HTML
', odcInstallation: 'DP-Check'
dependencyCheckPublisher pattern: '**/dependency-check-
report.xml'
}
}
stage("Build"){
steps{
sh " mvn clean install"
}
}
pipeline {
agent any
tools{
jdk 'jdk17'
maven 'maven3'
}
environment {
SCANNER_HOME=tool 'sonar-scanner'
}
stages{
stage("Git Checkout"){
steps{
git branch: 'main', changelog: false, poll: false, url:
'https://github.com/Aj7Ay/Petclinic.git'
}
}
stage("Compile"){
steps{
sh "mvn clean compile"
}
}
stage("Test Cases"){
steps{
sh "mvn test"
}
}
stage("Sonarqube Analysis "){
steps{
script {
withSonarQubeEnv(credentialsId: 'Sonar-token') {
sh 'mvn sonar:sonar'
}
}
}
}
stage("Build"){
steps{
sh " mvn clean install"
}
}
}
}
Docker Commons
Docker Pipeline
Docker API
docker-build-step
}
}
}
}
docker images
When you log in to Dockerhub, you will see a new image is created
stage("TRIVY"){
steps{
sh "trivy image sevenajay/pet-clinic123:latest"
}
}