forked from jenkins-infra/crawler
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
71 lines (61 loc) · 2 KB
/
Jenkinsfile
File metadata and controls
71 lines (61 loc) · 2 KB
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
#!/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 'jdk8'}",
"PATH+JAVA=${tool 'jdk8'}/bin"
]) {
stage('Build') {
sh 'mvn -e clean install'
}
stage('Generate') {
String command = '''
for f in *.groovy
do
groovy -Dgrape.config=./grapeConfig.xml ./lib/runner.groovy $f || true
done
'''
timestamps {
if (infra.isTrusted()) {
withCredentials([[$class: 'ZipFileBinding', credentialsId: 'update-center-signing', variable: 'SECRET']]) {
sh """
export JENKINS_SIGNER="-key \"$SECRET/update-center.key\" -certificate \"$SECRET/update-center.cert\" -root-certificate \"$SECRET/jenkins-update-center-root-ca.crt\"";
${command}
"""
}
}
else {
sh command
}
}
}
}
stage('Archive') {
dir ('target') {
archiveArtifacts '**'
}
}
if (infra.isTrusted()) {
stage('Publish') {
sh 'mkdir -p updates'
sh 'cp target/*.json target/*.html updates'
sshagent(['updates-rsync-key']) {
sh 'rsync -avz -e \'ssh -o StrictHostKeyChecking=no\' --exclude=.svn updates/ www-data@updates.jenkins.io:/var/www/updates.jenkins.io/updates/'
}
}
}
}