-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Jenkinsfile
85 lines (75 loc) · 2.63 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
#!/usr/bin/env groovy
properties([
buildDiscarder(logRotator(numToKeepStr: '2')),
pipelineTriggers([cron('H 5 * * 3')]),
])
node('linux') {
checkout scm
dir("scripts/build") {
deleteDir()
}
dir("build") {
deleteDir()
}
stage('Generate Javadocs') {
withEnv([
"PATH+MVN=${tool 'mvn'}/bin",
"JAVA_HOME=${tool 'jdk11'}",
"PATH+GROOVY=${tool 'groovy'}/bin",
"PATH+JAVA=${tool 'jdk11'}/bin",
]) {
if (infra.isTrusted()) {
sh './scripts/generate-javadoc.sh'
} else {
withCredentials([usernamePassword(
credentialsId: 'artifact-caching-proxy-credentials',
usernameVariable: 'ARTIFACT_CACHING_PROXY_USERNAME',
passwordVariable: 'ARTIFACT_CACHING_PROXY_PASSWORD'
)]) {
def repositoryOrigin = "https://repo." + (env.ARTIFACT_CACHING_PROXY_PROVIDER ?: 'azure') + ".jenkins.io"
withEnv(["ARTIFACT_CACHING_PROXY_ORIGIN=${repositoryOrigin}"]) {
sh './scripts/generate-javadoc.sh'
}
}
}
}
}
stage('Generate Shortnames') {
sh './scripts/generate-shortnames.sh'
}
stage('Prepare Latest') {
sh './scripts/default-to-latest.sh'
}
stage('Archive') {
sh 'cd build && tar -cjf javadoc-site.tar.bz2 site'
archiveArtifacts artifacts: 'build/*.tar.bz2',
allowEmptyArchive: false,
fingerprint: false,
onlyIfSuccessful: true
}
if (infra.isTrusted()){
stage('Publish on Azure') {
/* -> https://github.com/Azure/blobxfer
Require credential 'JAVADOC_STORAGEACCOUNTKEY' set to the storage account key */
withCredentials([string(credentialsId: 'JAVADOC_STORAGEACCOUNTKEY', variable: 'JAVADOC_STORAGEACCOUNTKEY')]) {
sh './scripts/blobxfer upload \
--local-path /data/site \
--storage-account-key $JAVADOC_STORAGEACCOUNTKEY \
--storage-account prodjavadoc \
--remote-path javadoc \
--recursive \
--mode file \
--skip-on-md5-match \
--file-md5 \
--connect-timeout 30 \
--delete'
}
}
}
stage('Clean up') {
echo 'We want to generate fresh javadocs on each run'
dir('build/site') {
deleteDir()
}
}
}