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"

}

}

}



}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Addressbook Tutorial1
====================

making a change to this file
This tutorial teaches you some of the basic concepts in [Vaadin Framework](https://vaadin.com). It is meant to be
a fast read for learning how to get started - not an example on how application should be
designed. Please note this example uses and requires Java 8 to work.
Expand Down
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:9
ADD addressbook.war /usr/local/tomcat/webapps/
EXPOSE 8080
CMD ["catalina.sh", "run"]
11 changes: 11 additions & 0 deletions multiStageDockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM maven:3.6.3-jdk-8 AS Build
RUN mkdir sample
WORKDIR sample
RUN git clone https://github.com/mohitkhokhar172/DevOpsClassCodes.git
RUN cd DevOpsClassCodes && mvn compile
RUN cd DevOpsClassCodes && mvn package

FROM tomcat:9
COPY --from=Build /sample/DevOpsClassCodes/target/addressbook.war /usr/local/tomcat/webapps
EXPOSE 8080
CMD ["catalina.sh", "run"]
11 changes: 11 additions & 0 deletions multistagedockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM maven:3.6.3-jdk-8 AS Build
RUN mkdir sample
WORKDIR sample
RUN git clone https://github.com/mohitkhokhar172/DevOpsClassCodes.git
RUN cd DevOpsClassCodes && mvn compile
RUN cd DevOpsClassCodes && mvn package

FROM tomcat:9.0.8-jre8-alpine
COPY --from=Build /sample/DevOpsClassCodes/target/addressbook.war /usr/local/tomcat/webapps
EXPOSE 8080
CMD ["catalina.sh", "run"]
2 changes: 2 additions & 0 deletions test_file
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Test to check webhook
Making another change
1 change: 1 addition & 0 deletions testwebhook
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
this change must trigger the build number 5 for the first project
5 changes: 5 additions & 0 deletions webhookfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
this change should trigger the compile project
this change must trigger the build number 6
this change will not afftec jenkins
this should trigger build number 7
this will trigger build 3