forked from harf18/escpospi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile
38 lines (29 loc) · 1.31 KB
/
Jenkinsfile
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
node{
stage("checkout"){
git url:'https://github.com/harf18/escpospi.git', branch:'develop'
echo BRANCH_NAME
}
def pom = readMavenPom file:'pom.xml'
stage("maven"){
withMaven { sh 'mvn clean verify' }
}
stage("Archive"){
archiveArtifacts artifacts: '**/target/*.jar'
}
stage("notify"){
if (BRANCH_NAME == 'master') {
echo BRANCH_NAME + ' => Deployement PROD'
slackSend channel: '#team-vem', color: 'good', message: 'Build sur Master (v. ' + pom.getVersion() + '). Deployer en PREPROD : <http://localhost:8080/job/W3-deploy-PREPROD/build?token=OAKej5o40yY9XqyFiY8b7DEYY6qv5XPd|GO>', teamDomain: 'devlescrous', tokenCredentialId : '1'
} else if (BRANCH_NAME.startsWith('release')){
echo BRANCH_NAME + ' => Deployement PREPROD'
slackSend channel: '#team-vem', color: 'good', message: 'Build sur ' + BRANCH_NAME + ' (v. ' + pom.getVersion() + '). Deployer en PROD : <http://localhost:8080/job/W3-deploy-PROD/build?token=OAKej5o40yY9XqyFiY8b7DEYY6qv5XPd|GO>', teamDomain: 'devlescrous', tokenCredentialId : '1'
}
}
}
def withMaven(def body){
def java = tool 'oracle-8u131'
def maven = tool 'maven-3.5.0'
withEnv(["JAVA_HOME=${java}", "PATH+MAVEN=${maven}/bin"]){
body.call()
}
}