-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJenkinsfile
114 lines (110 loc) · 6.27 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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
pipeline {
//agent any
agent {
label 'local'
}
stages {
stage('Checkout') {
steps {
cleanWs()
checkout([$class: 'GitSCM', branches: [[name: "*/master"]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'fmk-schemas']], submoduleCfg: [], userRemoteConfigs: [[url: 'https://github.com/trifork/fmk-schemas.git',credentialsId: 'github-app-FMK']]])
}
}
stage('build') {
steps {
script {
String jenkinsUserId = sh(returnStdout: true, script: 'id -u jenkins').trim()
String dockerGroupId = sh(returnStdout: true, script: 'getent group docker | cut -d: -f3').trim()
String containerUserMapping = "-u $jenkinsUserId:$dockerGroupId "
docker.image("registry.fmk.netic.dk/fmk/fmkbuilder_schema:11").inside(containerUserMapping + "--add-host ci.fmk.netic.dk:2a03:dc80:0:f12d::118 -e _JAVA_OPTIONS='-Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=false -Djava.net.preferIPv6Stack=true -Djava.net.preferIPv6Addresses=true'") {
now = new Date()
gitversion = "-${env.GIT_COMMIT}".substring(0,5)
version= now.format("YYYYMMddHHmmss")+gitversion
sh "echo Building $version"
withCredentials([usernamePassword(credentialsId: 'ci_nexus', passwordVariable: 'NexusPass', usernameVariable: 'NexusUser')]) {
sh 'cd fmk-schemas && ant -Drepo.user=$NexusUser -Drepo.pass=$NexusPass -v publish'
}
sh 'cd fmk-schemas && ant validate-all-wsdl'
}
nexusArtifactUploader(
nexusVersion: 'nexus3',
protocol: 'https',
nexusUrl: 'ci.fmk.netic.dk/nexus',
groupId: 'com.trifork',
version: "${version}",
repository: 'trifork-internal',
credentialsId: 'ci_nexus',
artifacts: [
[artifactId: 'fmk-schema-admin-classes',
classifier: '',
file: 'fmk-schemas/target/fmk-schema-admin-classes.jar',
type: 'jar'],
[artifactId: 'fmk-schema-admin',
classifier: '',
file: 'fmk-schemas/target/fmk-schema-admin.zip',
type: 'zip'],
[artifactId: 'fmk-schema-classes',
classifier: '',
file: 'fmk-schemas/target/fmk-schema-classes.jar',
type: 'jar'],
[artifactId: 'fmk-schema-dist',
classifier: '',
file: 'fmk-schemas/target/fmk-schema-dist.zip',
type: 'zip'],
[artifactId: 'fmk-schema-idws-xua',
classifier: '',
file: 'fmk-schemas/target/fmk-schema-idws-xua.zip',
type: 'zip'],
[artifactId: 'fmk-schema-idws',
classifier: '',
file: 'fmk-schemas/target/fmk-schema-idws.zip',
type: 'zip'],
[artifactId: 'fmk-schema',
classifier: '',
file: 'fmk-schemas/target/fmk-schema.zip',
type: 'zip'],
[artifactId: 'fmk-schema-testtool-classes',
classifier: '',
file: 'fmk-schemas/target/fmk-schema-testtool-classes.jar',
type: 'jar'],
[artifactId: 'fmk-schema-testtool',
classifier: '',
file: 'fmk-schemas/target/fmk-schema-testtool.zip',
type: 'zip'],
[artifactId: 'fmk-schema-source.zip',
classifier: '',
file: 'fmk-schemas/target/fmk-schema-source.zip',
type: 'zip'],
[artifactId: 'NamespaceOracle-generated.properties',
classifier: '',
file: 'fmk-schemas/target/NamespaceOracle-generated.properties',
type: 'properties'],
[artifactId: 'fmk-schema-classes-deps',
classifier: '',
file: 'fmk-schemas/target/fmk-schema-classes-deps.jar',
type: 'jar']
]
)
archiveArtifacts 'fmk-schemas/target/wsdl/*.zip, fmk-schemas/target/standard/target/wsdl/*.zip, fmk-schemas/target/idws/target/wsdl/*.zip, fmk-schemas/target/standard/target/wsdl/*.wsdl, fmk-schemas/target/idws/target/wsdl/*.wsdl'
}
}
}
}
post {
failure {
emailext body: '$DEFAULT_CONTENT',
recipientProviders: [culprits(), requestor()],
subject: '$DEFAULT_SUBJECT'
}
unstable {
emailext body: '$DEFAULT_CONTENT',
recipientProviders: [culprits(), requestor()],
subject: '$DEFAULT_SUBJECT'
}
fixed {
emailext body: '$DEFAULT_CONTENT',
recipientProviders: [culprits(), requestor()],
subject: '$DEFAULT_SUBJECT'
}
}
}