Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Branches created #20

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 17 additions & 71 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,82 +1,28 @@
pipeline {
agent any
tools{
agent any

tools {
jdk 'jdk11'
maven 'maven3'
}

environment {
SCANNER_HOME=tool 'sonar-scanner'
maven'maven3'
}

stages{

stage("Git Checkout"){
steps{
git branch: 'main', changelog: false, poll: false, url: 'https://github.com/jaiswaladi246/Petclinic.git'

stages {
stage('Git Checkout') {
steps {
git branch: 'main', url: 'https://github.com/jaiswaladi246/Petclinic.git'
}
}

stage("Compile"){
steps{
sh "mvn clean compile"
stage('Compile') {
steps {
sh "mvn clean compile"
}
}

stage("Test Cases"){
steps{
sh "mvn test"
stage('Build') {
steps {
sh "mvn clean package -DskipTests-true"
}
}

stage("Sonarqube Analysis "){
steps{
withSonarQubeEnv('sonar-server') {
sh ''' $SCANNER_HOME/bin/sonar-scanner -Dsonar.projectName=Petclinic \
-Dsonar.java.binaries=. \
-Dsonar.projectKey=Petclinic '''

}
}
}

stage("OWASP Dependency Check"){
steps{
dependencyCheck additionalArguments: '--scan ./ --format HTML ', odcInstallation: 'DP'
dependencyCheckPublisher pattern: '**/dependency-check-report.xml'
}

}

stage("Build"){
steps{
sh " mvn clean install"
}
}

stage("Docker Build & Push"){
steps{
script{
withDockerRegistry(credentialsId: '58be877c-9294-410e-98ee-6a959d73b352', toolName: 'docker') {

sh "docker build -t image1 ."
sh "docker tag image1 adijaiswal/pet-clinic123:latest "
sh "docker push adijaiswal/pet-clinic123:latest "
}
}
}
}

stage("TRIVY"){
steps{
sh " trivy image adijaiswal/pet-clinic123:latest"
}
}

stage("Deploy To Tomcat"){
steps{
sh "cp /var/lib/jenkins/workspace/CI-CD/target/petclinic.war /opt/apache-tomcat-9.0.65/webapps/ "
}
}
}
}

26 changes: 26 additions & 0 deletions Script.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
pipeline {
agent any

tools {
jdk 'jdk11'
maven'maven3'
}

stages {
stage('Git Checkout') {
steps {
git branch: 'main', url: 'https://github.com/jaiswaladi246/Petclinic.git'
}
}
stage('Compile') {
steps {
sh "mvn clean compile"
}
}
stage('Build') {
steps {
sh "mvn clean package -DskipTests-true"
}
}
}
}
185 changes: 0 additions & 185 deletions Steps.txt

This file was deleted.