forked from matteosusca/po-test-json-validator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile2
92 lines (81 loc) · 5.39 KB
/
Jenkinsfile2
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
pipeline {
agent {
docker {
image 'iubar-java-alpine'
label 'docker'
args '-v ${HOME}/.m2:/home/jenkins/.m2:rw,z -v ${HOME}/.sonar:/home/jenkins/.sonar:rw,z'
}
}
options {
ansiColor('xterm')
}
environment {
MAVEN_ARGS = '--show-version --batch-mode --quiet'
MAVEN_OPTS = '-Dmaven.test.failure.ignore=false -Dstyle.color=always -Djava.awt.headless=true -Dhttps.protocols=TLSv1.2' // -Djava.io.tmpdir=${WORKSPACE}@tmp
}
stages {
stage('Scm') {
steps {
echo 'Check out cedolini'
checkout changelog: false, poll: false, scm: [$class: 'SubversionSCM', locations: [[credentialsId: 'my-svn-server-account-id', local: 'data/cedolini/json', remote: 'https://192.168.0.121/svn/java/iubar-paghe-test/trunk/src/test/resources/cedolini/json']]]
// svn non è installato in iubar-maven-alpine, altrimenti avrei usato: sh 'svn export https://192.168.0.121/svn/java/iubar-paghe-test/trunk/src/main/resources/json/template.json'
sh 'wget https://192.168.0.121/svn/java/iubar-paghe-test/trunk/src/test/resources/cedolini/json/schema/schema.json --no-check-certificate -P data/cedolini'
echo 'Check out uniemens'
checkout changelog: false, poll: false, scm: [$class: 'SubversionSCM', locations: [[credentialsId: 'my-svn-server-account-id', local: 'data/uniemens/json', remote: 'https://192.168.0.121/svn/java/iubar-paghe-test/trunk/src/test/resources/uniemens/json']]]
sh 'wget https://192.168.0.121/svn/java/iubar-paghe-test/trunk/src/test/resources/uniemens/json/schema/schema.json --no-check-certificate -P data/uniemens'
echo 'Check out F24'
checkout changelog: false, poll: false, scm: [$class: 'SubversionSCM', locations: [[credentialsId: 'my-svn-server-account-id', local: 'data/f24/json', remote: 'https://192.168.0.121/svn/java/iubar-paghe-test/trunk/src/test/resources/f24/json']]]
sh 'wget https://192.168.0.121/svn/java/iubar-paghe-test/trunk/src/test/resources/f24/json/schema/schema.json --no-check-certificate -P data/f24'
echo 'Check out nota contabile'
checkout changelog: false, poll: false, scm: [$class: 'SubversionSCM', locations: [[credentialsId: 'my-svn-server-account-id', local: 'data/notacontabile/json', remote: 'https://192.168.0.121/svn/java/iubar-paghe-test/trunk/src/test/resources/notacontabile/json']]]
sh 'wget https://192.168.0.121/svn/java/iubar-paghe-test/trunk/src/test/resources/notacontabile/json/schema/schema.json --no-check-certificate -P data/notacontabile'
echo 'Downloading the schema...'
sh 'wget http://json-schema.org/draft-07/schema -O $WORKSPACE/draft-07.json'
}
}
stage('Package') {
steps {
sh 'mvn $MAVEN_ARGS $MAVEN_OPTS clean package -DexcludedGroups="Skip"'
// ...or alternatively..
// sh 'wget https://github.com/iubar/po-test-json-validator/releases/download/00.01/po-test-json-validator-jar-with-dependencies.jar'
}
post {
always {
junit 'target/surefire-reports/*.xml' // show junit log in Jenkins
}
}
}
stage('Validate json') {
steps {
sh 'ls -la $WORKSPACE'
echo 'Validazione schema.json cedolini'
sh 'cd target && java -jar json-validator-jar-with-dependencies.jar $WORKSPACE/draft-07.json $WORKSPACE/data/cedolini/schema.json'
echo 'Validazione file json cedolini'
sh 'cd target && java -jar json-validator-jar-with-dependencies.jar $WORKSPACE/data/cedolini/schema.json $WORKSPACE/data/cedolini/json'
echo 'Validazione schema.json uniemens'
sh 'cd target && java -jar json-validator-jar-with-dependencies.jar $WORKSPACE/draft-07.json $WORKSPACE/data/uniemens/schema.json'
echo 'Validazione file json uniemens'
sh 'cd target && java -jar json-validator-jar-with-dependencies.jar $WORKSPACE/data/uniemens/schema.json $WORKSPACE/data/uniemens/json'
echo 'Validazione schema.json F24'
sh 'cd target && java -jar json-validator-jar-with-dependencies.jar $WORKSPACE/draft-07.json $WORKSPACE/data/f24/schema.json'
echo 'Validazione file json F24'
sh 'cd target && java -jar json-validator-jar-with-dependencies.jar $WORKSPACE/data/f24/schema.json $WORKSPACE/data/f24/json'
echo 'Validazione schema.json nota contabile'
sh 'cd target && java -jar json-validator-jar-with-dependencies.jar $WORKSPACE/draft-07.json $WORKSPACE/data/notacontabile/schema.json'
echo 'Validazione file json nota contabile'
sh 'cd target && java -jar json-validator-jar-with-dependencies.jar $WORKSPACE/data/f24/schema.json $WORKSPACE/data/notacontabile/json'
}
}
}
post {
always { // oppure utilizzare changed
sh "curl -H 'JENKINS: Pipeline Hook Iubar' -i -X GET -G ${env.IUBAR_WEBHOOK_URL} -d status=${currentBuild.currentResult} -d job_name='${JOB_NAME}' -d build_number='${BUILD_NUMBER}'"
}
cleanup {
cleanWs()
dir("${WORKSPACE}@tmp") {
deleteDir()
}
}
}
}