Skip to content
Open

Dev #16

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
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
node
{

def mavenHome = tool name: "maven3.6.2"
def mavenHome = tool name: "maven3.8.6"

echo "GitHub BranhName ${env.BRANCH_NAME}"
echo "Jenkins Job Number ${env.BUILD_NUMBER}"
Expand Down
59 changes: 59 additions & 0 deletions pipeline-declarative
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
pipeline{
agent any
tools {
maven "maven3.8.6"
}
stages {
stage('1cloning'){
steps{
sh "echo 'cloning the latest application version' "
git credentialsId: 'jkgitcred', url: 'https://github.com/christinedee/maven-web-application.git' //for private repo, generate pipeline syntax
//git "repolink" or sh "git clone repolink" only works for public repositories
}
}
stage('2Test+Build'){
steps{
sh "echo 'running JUnit-test-cases' "
sh "echo 'testing must be passed to create artifacts' "
sh "mvn clean package"
}
}
stage('3Codequality'){
steps{
sh "echo 'performing code quality analysis with sonarQb' "
sh "mvn sonar:sonar"
}
}

stage('4uploadNexus'){
steps{
sh "echo 'uploading artifacts to nexus' "
sh "mvn deploy"
}
}
stage('5deploy2uat'){
steps{
deploy adapters: [tomcat9(credentialsId: 'deployment', path: '', url: 'http://54.215.245.202:8080/')], contextPath: '/opt/webapps', war: 'target/*war'
}

}

stage('6deploy2prod'){
steps{
deploy adapters: [tomcat9(credentialsId: 'deployment', path: '', url: 'http://54.215.245.202:8080/')], contextPath: '/opt/webapps', war: 'target/*war'
}
}
}

post {
always{
emailext body: 'check build status', recipientProviders: [buildUser(), contributor(), developers(), previous(), upstreamDevelopers()], subject: 'success', to: 'nayalea353@gmail.com'
}
success{
emailext body: 'build and deployment is successful', recipientProviders: [buildUser(), contributor(), developers(), previous(), upstreamDevelopers()], subject: 'success', to: 'nayalea353@gmail.com'
}
failure{
emailext body: 'build failed, check pipeline script', recipientProviders: [buildUser(), contributor(), developers(), previous(), upstreamDevelopers()], subject: 'success', to: 'nayalea353@gmail.com'
}
}
}
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<spring.version>5.1.2.RELEASE</spring.version>
<junit.version>4.11</junit.version>
<log4j.version>1.2.17</log4j.version>
<sonar.host.url>http:3.96.196.171:9000/</sonar.host.url>
<sonar.host.url>http:172.31.17.108:9000/</sonar.host.url>
<sonar.login>admin</sonar.login>
<sonar.password>admin</sonar.password>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down Expand Up @@ -98,13 +98,13 @@
<repository>
<id>nexus</id>
<name>Landmark Technologies Releases Nexus Repository</name>
<url>http://35.174.19.3:8081/repository/amazon-release/</url>
<url>http://52.9.37.93:8081/repository/pipe-releases/</url>
</repository>

<snapshotRepository>
<id>nexus</id>
<name>Landmark Technologies Snapshot Nexus Repository </name>
<url>http://35.174.19.3:8081/repository/amazon-snapshot/</url>
<url>http://52.9.37.93:8081/repository/pipe-snapshots/</url>
</snapshotRepository>

</distributionManagement>
Expand Down