Skip to content
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
111 changes: 111 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
pipeline{
tools{
jdk 'myjava'
maven 'mymaven1'
}
environment {

registry = "mohitkhokhar172/sample"

registryCredential = 'devopslearner45'

dockerImage = ''

}
agent none
stages{
stage('Checkout'){
agent any
steps{
git 'https://github.com/devops-trainer/DevOpsClassCodes.git'
}
}
stage('Compile'){
agent any
steps{
sh 'mvn compile'
}
}
stage('CodeReview'){
agent any
steps{
sh 'mvn pmd:pmd'
}
}
stage('UnitTest'){
agent any
steps{
//git 'https://github.com/devops-trainer/DevOpsClassCodes.git'
sh 'mvn test'
}
}
stage('MetricCheck'){
agent any
steps{
sh 'mvn cobertura:cobertura -Dcobertura.report.format=xml'
}
}
stage('Package'){
agent any
steps{
sh 'mvn package'
}
}



stage('Cloning our Git') {
agent any
steps {

git 'https://github.com/mohitkhokhar172/DevOpsClassCodes.git'

}

}

stage('Building our image') {
agent any
steps {

script {
sh 'whoami'
dockerImage = docker.build registry + ":$BUILD_NUMBER"

}

}

}

stage('Deploy our image') {
agent any
steps {

script {

docker.withRegistry( '', registryCredential ) {
dockerImage.push()
}

}

}

}

stage('Cleaning up') {
agent any
steps {

sh "docker rmi $registry:$BUILD_NUMBER"

}

}

}



}
Binary file added addressbook.war
Binary file not shown.
4 changes: 4 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM tomcat:8
ADD addressbook.war /usr/local/tomcat/webapps/
EXPOSE 8080
CMD ["catalina.sh", "run"]
2 changes: 2 additions & 0 deletions sample.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
this a change made on the test barnch