-
Notifications
You must be signed in to change notification settings - Fork 67
/
Jenkinsfile
59 lines (50 loc) · 1.5 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
#!/usr/bin/env groovy
List p = [buildDiscarder(logRotator(numToKeepStr: '5'))]
/* When we're running inside our trusted infrastructure, we want to
* re-generate the tools meta-data every four hours
*/
if (infra.isTrusted()) {
p.add(pipelineTriggers([cron('H */4 * * *')]))
p.add(disableConcurrentBuilds())
}
properties(p)
node('linux') {
stage ('Prepare') {
deleteDir()
checkout scm
}
withEnv([
"PATH+GROOVY=${tool 'groovy'}/bin",
"PATH+MVN=${tool 'mvn'}/bin",
"JAVA_HOME=${tool 'jdk17'}",
"PATH+JAVA=${tool 'jdk17'}/bin"
]) {
stage('Build') {
sh 'mvn -e clean install'
}
stage('Generate') {
timestamps {
if (infra.isTrusted()) {
withCredentials([[$class: 'ZipFileBinding', credentialsId: 'update-center-signing', variable: 'SECRET']]) {
sh 'bash ./.jenkins-scripts/generate.sh'
}
}
else {
sh 'bash ./.jenkins-scripts/generate.sh'
}
}
}
}
stage('Archive') {
dir ('target') {
archiveArtifacts '**'
}
}
if (infra.isTrusted()) {
stage('Publish') {
withCredentials([[$class: 'ZipFileBinding', credentialsId: 'update-center-publish-env', variable: 'UPDATE_CENTER_FILESHARES_ENV_FILES']]) {
sh 'bash ./.jenkins-scripts/publish.sh'
}
}
}
}