forked from DevOpsManiac/CorpSite
-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathJenkinsfile.ci
60 lines (55 loc) · 1.79 KB
/
Jenkinsfile.ci
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
49
50
51
52
53
54
55
56
57
58
59
60
pipeline {
agent any
tools {
maven 'Jenkins Maven'
}
stages {
stage('Build') {
steps {
sh '''
export M2_HOME=/opt/apache-maven-3.6.0 # your Mavan home path
export PATH=$PATH:$M2_HOME/bin
mvn --version
'''
sh 'mvn compile'
}
}
stage('Test') {
steps {
/*
sh '''
export M2_HOME=/opt/apache-maven-3.6.0 # your Mavan home path
export PATH=$PATH:$M2_HOME/bin
mvn --version
'''
*/
sh 'mvn verify'
}
post {
success {
junit '**/target/surefire-reports/*.xml'
}
}
}
stage('Publish') {
steps {
script {
echo '(publishing artifact)'
}
script {
echo 'publishing to artifactory (greydon)'
def server = Artifactory.server 'greydon'
def uploadSpec = """{
"files": [
{
"pattern": "target/*.war",
"target": "example-repo-local"
}]}"""
//publish to Artifactory
server.upload spec: uploadSpec
}
snDevOpsArtifact(artifactsPayload:"""{"artifacts": [{"name": "globex-web.war","version":"1.${env.BUILD_NUMBER}","semanticVersion": "1.${env.BUILD_NUMBER}.0","repositoryName": "corpsite", "pipelineName": "${env.JOB_BASE_NAME}"}]}""")
}
}
}
}