This repository was archived by the owner on Jan 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
48 lines (34 loc) · 1.34 KB
/
Jenkinsfile
File metadata and controls
48 lines (34 loc) · 1.34 KB
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
45
46
47
48
node{
try{
stage('Checkout'){
deleteDir() //cleanup workspace
checkout scm
}
stage('Build'){
sh 'mvn install -DskipTests'
archiveArtifacts allowEmptyArchive: true, artifacts: '**/target/*.war', fingerprint: true
}
stage('Deploy'){
if(env.BRANCH_NAME == 'develop'){
sh 'cp target/githubr750.war /data/r750'
}
if(env.BRANCH_NAME == 'master'){
echo 'Deploy master on PROD Server ...'
withCredentials([usernamePassword(credentialsId: 'r750explorer', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
// available as an env variable, but will be masked if you try to print it out any which way
sh 'echo $PASSWORD'
// also available as a Groovy variable—note double quotes for string interpolation
echo "$USERNAME"
sh "ssh $USERNAME@r750explorer.me \"echo ${env.BUILD_ID}\""
}
}
}
stage('Test'){
sh 'mvn test'
junit 'target/surefire-reports/*.xml'
step( [ $class: 'JacocoPublisher' ] )
}
} catch (e){
echo e
}
}