forked from gouthamchilakala/PetClinic
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjfile
44 lines (42 loc) · 1.88 KB
/
jfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
node {
def mvnHome = tool name: 'Maven_3', type: 'maven'
def mvnCli = "${mvnHome}/bin/mvn"
properties([
buildDiscarder(logRotator(artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', numToKeepStr: '5')),
disableConcurrentBuilds(),
[$class: 'GithubProjectProperty', displayName: '', projectUrlStr: 'https://github.com/gouthamchilakala/PetClinic.git/'],
[$class: 'ThrottleJobProperty', categories: [], limitOneJobWithMatchingParams: false, maxConcurrentPerNode: 0, maxConcurrentTotal: 0, paramsToUseForLimit: '', throttleEnabled: true, throttleOption: 'project'],
pipelineTriggers([githubPush()]),
parameters([string(defaultValue: 'DEV', description: 'env name', name: 'environment', trim: false)])
])
stage('Checkout SCM'){
git branch: 'master', credentialsId: 'github-creds', url: 'https://github.com/gouthamchilakala/PetClinic'
}
stage('Read praram'){
echo "The environment chosen during the Job execution is ${params.environment}"
echo "$JENKINS_URL"
}
stage('maven compile'){
// def mvnHome = tool name: 'Maven_3.6', type: 'maven'
// def mvnCli = "${mvnHome}/bin/mvn"
sh "${mvnCli} clean compile"
}
stage('maven package'){
sh "${mvnCli} package -Dmaven.test.skip=true"
}
stage('Archive atifacts'){
archiveArtifacts artifacts: '**/*.war', onlyIfSuccessful: true
}
stage('Archive Test Results'){
junit allowEmptyResults: true, testResults: '**/surefire-reports/*.xml'
}
stage('Deploy To Tomcat'){
sshagent(['app-server']) {
sh 'scp -o StrictHostKeyChecking=no target/*.war [email protected]:/opt/apache-tomcat-8.5.38/webapps/'
}
}
stage('Smoke Test'){
sleep 5
sh "curl ec2-52-70-39-48.compute-1.amazonaws.com:8080/petclinic"
}
}